Changeset 5747 for code/trunk/src/libraries/core
- Timestamp:
- Sep 19, 2009, 11:17:51 PM (15 years ago)
- Location:
- code/trunk/src/libraries/core
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/Core.cc
r5738 r5747 284 284 DynLibManager::getInstance().load(librarypath.string()); 285 285 } 286 catch (const std::exception& e)287 {288 COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << e.what() << std::endl;289 }290 286 catch (...) 291 287 { 292 COUT(1) << "Couldn't load module \"" << librarypath.string() << "\" "<< std::endl;288 COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << Exception::handleMessage() << std::endl; 293 289 } 294 290 } … … 298 294 } 299 295 } 300 catch (const std::exception& e)301 {302 COUT(1) << "An error occurred while loading modules: " << e.what() << std::endl;303 }304 296 catch (...) 305 297 { 306 COUT(1) << "An error occurred while loading modules ."<< std::endl;298 COUT(1) << "An error occurred while loading modules: " << Exception::handleMessage() << std::endl; 307 299 } 308 300 … … 398 390 catch (...) 399 391 { 400 COUT(0) << "An exception occurred during ' new GraphicsManager' while "401 << " another exception was being handled. This willlead to undefined behaviour!" << std::endl392 COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl 393 << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl 402 394 << "Terminating the program." << std::endl; 403 395 abort(); -
code/trunk/src/libraries/core/Game.cc
r5738 r5747 37 37 #include <exception> 38 38 #include <boost/weak_ptr.hpp> 39 #include <CEGUIExceptions.h>40 39 41 40 #include "util/Debug.h" … … 204 203 catch (...) 205 204 { 206 COUT(0) << "An exception occurred in the Core preUpdate: " << Game::getExceptionMessage() << std::endl;205 COUT(0) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << std::endl; 207 206 COUT(0) << "This should really never happen! Closing the program." << std::endl; 208 207 this->stop(); … … 218 217 catch (...) 219 218 { 220 COUT(0) << "An exception occurred in the Core postUpdate: " << Game::getExceptionMessage() << std::endl;221 COUT(0) << "This should really never happen! Closing the program." << std::endl;219 COUT(0) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << std::endl; 220 COUT(0) << "This should really never happen! Closing the program." << std::endl; 222 221 this->stop(); 223 222 break; … … 254 253 catch (...) 255 254 { 256 COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Game::getExceptionMessage() << std::endl;255 COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << std::endl; 257 256 // All scheduled operations have now been rendered inert --> flush them and issue a warning 258 257 if (this->requestedStateNodes_.size() > 1) … … 285 284 catch (...) 286 285 { 287 COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Game::getExceptionMessage() << std::endl;286 COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << std::endl; 288 287 COUT(1) << "This should really never happen!" << std::endl; 289 288 COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl; … … 593 592 catch (...) 594 593 { 595 COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Game::getExceptionMessage() << std::endl;594 COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << std::endl; 596 595 COUT(2) << " There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl; 597 596 } … … 608 607 } 609 608 610 /*static*/ std::string Game::getExceptionMessage()611 {612 std::string exceptionMessage;613 try614 {615 // rethrow616 throw;617 }618 catch (const std::exception& ex)619 {620 return ex.what();621 }622 catch (const CEGUI::Exception& ex)623 {624 #if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6625 return GeneralException(ex.getMessage().c_str()).getDescription();626 #else627 return GeneralException(ex.getMessage().c_str(), ex.getLine(),628 ex.getFileName().c_str(), ex.getName().c_str()).getDescription();629 #endif630 }631 catch (...)632 {633 return "Unknown exception";634 }635 }636 637 609 std::map<std::string, shared_ptr<Game::GameStateFactory> > Game::GameStateFactory::factories_s; 638 610 -
code/trunk/src/libraries/core/Game.h
r5738 r5747 155 155 // ScopeGuard helper function 156 156 void resetChangingState() { this->bChangingState_ = false; } 157 /**158 @brief159 Retrieves information from an exception caught with "..."160 @remarks161 Never ever call this function without an exception in the stack!162 */163 static std::string getExceptionMessage();164 157 165 158 scoped_ptr<Clock> gameClock_; -
code/trunk/src/libraries/core/GraphicsManager.cc
r5738 r5747 172 172 // scripts for the 1.6 version and then remove the inserted "particle_system" 173 173 // keyword. But we need to supply these new scripts as well, which is why 174 // there is an extra Ogre::Archive dealing with i n the memory.174 // there is an extra Ogre::Archive dealing with it in the memory. 175 175 using namespace Ogre; 176 176 ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get()); -
code/trunk/src/libraries/core/IRC.cc
r5738 r5747 32 32 33 33 #include "util/Convert.h" 34 #include "util/Exception.h" 34 35 #include "ConsoleCommand.h" 35 36 #include "CoreIncludes.h" … … 64 65 catch (Tcl::tcl_error const &e) 65 66 { COUT(1) << "Tcl (IRC) error: " << e.what(); } 66 catch ( std::exception const &e)67 { COUT(1) << "Error while initializing Tcl (IRC): " << e.what(); }67 catch (...) 68 { COUT(1) << "Error while initializing Tcl (IRC): " << Exception::handleMessage(); } 68 69 69 70 this->nickname_ = "orx" + multi_cast<std::string>(static_cast<unsigned int>(rand())); … … 94 95 catch (Tcl::tcl_error const &e) 95 96 { COUT(1) << "Tcl (IRC) error: " << e.what(); } 96 catch ( std::exception const &e)97 { COUT(1) << "Error while executing Tcl (IRC): " << e.what(); }97 catch (...) 98 { COUT(1) << "Error while executing Tcl (IRC): " << Exception::handleMessage(); } 98 99 99 100 return false; -
code/trunk/src/libraries/core/Loader.cc
r5738 r5747 187 187 return false; 188 188 } 189 catch ( std::exception& ex)189 catch (...) 190 190 { 191 191 COUT(1) << std::endl; 192 192 COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl; 193 COUT(1) << ex.what() << std::endl; 194 COUT(1) << "Loading aborted." << std::endl; 195 return false; 196 } 197 catch (...) 198 { 199 COUT(1) << std::endl; 200 COUT(1) << "An unknown error occurred in Loader.cc while loading " << file->getFilename() << ":" << std::endl; 193 COUT(1) << Exception::handleMessage() << std::endl; 201 194 COUT(1) << "Loading aborted." << std::endl; 202 195 return false; -
code/trunk/src/libraries/core/TclBind.cc
r5738 r5747 35 35 #include "SpecialConfig.h" 36 36 #include "util/Debug.h" 37 #include "util/Exception.h" 37 38 #include "util/StringUtils.h" 38 39 #include "CommandExecutor.h" … … 92 93 catch (Tcl::tcl_error const &e) 93 94 { COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl; } 94 catch (std::exception const &e)95 { COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl; }96 95 catch (...) 97 { COUT(1) << "Error while creating Tcl-interpreter ."<< std::endl; }96 { COUT(1) << "Error while creating Tcl-interpreter: " << Exception::handleMessage() << std::endl; } 98 97 } 99 98 } … … 115 114 catch (Tcl::tcl_error const &e) 116 115 { COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl; } 117 catch (std::exception const &e)118 { COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl; }119 116 catch (...) 120 { COUT(1) << "Error while creating Tcl-interpreter ."<< std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl; }117 { COUT(1) << "Error while creating Tcl-interpreter: " << Exception::handleMessage() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl; } 121 118 122 119 return interpreter; … … 178 175 catch (Tcl::tcl_error const &e) 179 176 { COUT(1) << "tcl> Error: " << e.what() << std::endl; } 180 catch ( std::exception const &e)181 { COUT(1) << "Error while executing Tcl: " << e.what() << std::endl; }177 catch (...) 178 { COUT(1) << "Error while executing Tcl: " << Exception::handleMessage() << std::endl; } 182 179 } 183 180 … … 199 196 catch (Tcl::tcl_error const &e) 200 197 { COUT(1) << "Tcl error: " << e.what() << std::endl; } 201 catch ( std::exception const &e)202 { COUT(1) << "Error while executing Tcl: " << e.what() << std::endl; }198 catch (...) 199 { COUT(1) << "Error while executing Tcl: " << Exception::handleMessage() << std::endl; } 203 200 204 201 return false; -
code/trunk/src/libraries/core/TclThreadManager.cc
r5738 r5747 37 37 38 38 #include "util/Convert.h" 39 #include "util/Exception.h" 39 40 #include "Clock.h" 40 41 #include "CommandExecutor.h" … … 285 286 catch (const Tcl::tcl_error& e) 286 287 { bundle->interpreter_ = 0; COUT(1) << "Tcl error while creating Tcl-interpreter (" << id_string << "): " << e.what() << std::endl; } 287 catch (const std::exception& e)288 { bundle->interpreter_ = 0; COUT(1) << "Error while creating Tcl-interpreter (" << id_string << "): " << e.what() << std::endl; }289 288 catch (...) 290 { bundle->interpreter_ = 0; COUT(1) << " An error occurred while creating a new Tcl-interpreter (" << id_string << ")"<< std::endl; }289 { bundle->interpreter_ = 0; COUT(1) << "Error while creating Tcl-interpreter (" << id_string << "): " << Exception::handleMessage() << std::endl; } 291 290 } 292 291 -
code/trunk/src/libraries/core/XMLPort.h
r5738 r5747 591 591 throw ex; 592 592 } 593 catch ( std::exception& ex)593 catch (...) 594 594 { 595 595 COUT(1) << "An error occurred while loading object:" << std::endl; 596 COUT(1) << ex.what() << std::endl; 597 } 598 catch (...) 599 { 600 COUT(1) << "An unknown error occurred while loading object." << std::endl; 596 COUT(1) << Exception::handleMessage() << std::endl; 601 597 } 602 598 } -
code/trunk/src/libraries/core/input/InputDevice.h
r5738 r5747 42 42 43 43 #include "util/Debug.h" 44 #include "util/Exception.h" 44 45 #include "core/Clock.h" 45 46 #include "InputState.h" … … 145 146 catch (...) 146 147 { 147 COUT(1) << this->getClassName() << " destruction failed! Potential resource leak!" << std::endl; 148 COUT(1) << this->getClassName() << " destruction failed: " << Exception::handleMessage() << std::endl 149 << " Potential resource leak!" << std::endl; 148 150 } 149 151 } -
code/trunk/src/libraries/core/input/InputManager.cc
r5738 r5747 330 330 catch (...) 331 331 { 332 CCOUT(1) << className << " destruction failed! Potential resource leak!" << std::endl; 332 COUT(1) << className << " destruction failed: " << Exception::handleMessage() << std::endl 333 << " Potential resource leak!" << std::endl; 333 334 } 334 335 } … … 342 343 catch (...) 343 344 { 344 CCOUT(1) << "OIS::InputManager destruction failed! Potential resource leak!" << std::endl; 345 COUT(1) << "OIS::InputManager destruction failed" << Exception::handleMessage() << std::endl 346 << " Potential resource leak!" << std::endl; 345 347 } 346 348 oisInputManager_ = NULL;
Note: See TracChangeset
for help on using the changeset viewer.