Planet
navi homeaboutscreenshotsdownloaddevelopmentforum

Exceptions

TracNav(TracNav/TOC_Development)?

This article assumes that you know what an Exception is and how to throw it. Otherwise, see wikipedia or cpluscplus.com.

When an exception gets thrown, its message, containing file, line number, function name, exception type and programmer message, is displayed via orxout(internal_error). That means the user usually doesn't see them anywhere because it is better left up to the programmer to display the message at the right position. But you can still open the log and search for it unless the output level is below internal_error.

To throw an exception you best use the 'ThrowException?(type, message)' macro that automatically adds line number, function and file name. 'Type' is a user defined derived class of orxonox::Exception so that different exceptions can be caught with different 'catch' clauses.
Currently available types are:

Name Description
General Anything. Avoid using it and rather define a new one.
FileNotFound? Obviously a file was not found
Argument A function argument in a parser was wrong.
PluginsNotFound? No Ogre plugins were found but are required
InitialisationFailed? When starting the game engine, something went terribly wrong.
NotImplemented? The feature requested has not yet been implemented
GameState? Something went wrong with a GameState? class


Last modified 6 years ago Last modified on Aug 22, 2011, 2:25:57 PM