28 #ifndef __Exception_H_
29 #define __Exception_H_
40 #if OGRE_ASSERT_MODE == 1
42 # define OgreAssert( a, b ) assert( (a) && (b) )
44 # if OGRE_COMP != OGRE_COMPILER_BORL
45 # define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), "no function info")
47 # define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), __FUNC__ )
52 #elif OGRE_ASSERT_MODE == 2
53 # if OGRE_COMP != OGRE_COMPILER_BORL
54 # define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), "no function info")
56 # define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), __FUNC__ )
61 # define OgreAssert( a, b ) assert( (a) && (b) )
119 Exception(
int number,
const String& description,
const String& source,
const char* type,
const char* file,
long line );
142 virtual const String& getFullDescription(
void)
const;
146 virtual int getNumber(
void)
const throw();
150 virtual const
String &getSource()
const {
return source; }
167 const char*
what()
const throw() {
return getFullDescription().c_str(); }
179 :
Exception(inNumber, inDescription, inSource,
"UnimplementedException", inFile, inLine) {}
185 :
Exception(inNumber, inDescription, inSource,
"FileNotFoundException", inFile, inLine) {}
191 :
Exception(inNumber, inDescription, inSource,
"IOException", inFile, inLine) {}
197 :
Exception(inNumber, inDescription, inSource,
"InvalidStateException", inFile, inLine) {}
203 :
Exception(inNumber, inDescription, inSource,
"InvalidParametersException", inFile, inLine) {}
209 :
Exception(inNumber, inDescription, inSource,
"ItemIdentityException", inFile, inLine) {}
215 :
Exception(inNumber, inDescription, inSource,
"InternalErrorException", inFile, inLine) {}
221 :
Exception(inNumber, inDescription, inSource,
"RenderingAPIException", inFile, inLine) {}
227 :
Exception(inNumber, inDescription, inSource,
"RuntimeAssertionException", inFile, inLine) {}
243 const String& src,
const char* file,
long line)
257 default:
throw Exception(number, desc, src,
"Exception", file, line);
265 #define OGRE_EXCEPT(code, desc, src) Ogre::ExceptionFactory::throwException(code, code, desc, src, __FILE__, __LINE__);
266 #define OGRE_EXCEPT_EX(code, num, desc, src) Ogre::ExceptionFactory::throwException(code, num, desc, src, __FILE__, __LINE__);
268 #define OGRE_EXCEPT_EX(code, num, desc, src) OGRE_EXCEPT(code, desc, src);
IOException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
UnimplementedException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
static OGRE_NORETURN void throwException(Exception::ExceptionCodes code, int number, const String &desc, const String &src, const char *file, long line)
ItemIdentityException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
InvalidStateException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
RenderingAPIException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
const char * what() const
Override std::exception::what.
virtual const String & getDescription(void) const
Returns a string with only the 'description' field of this exception.
RuntimeAssertionException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
virtual long getLine() const
Gets line number.
ExceptionFactory()
Private constructor, no construction.
virtual const String & getFile() const
Gets source file name.
Class implementing dispatch method in order to construct by-value exceptions of a derived type based ...
InternalErrorException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
FileNotFoundException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
~Exception()
Needed for compatibility with std::exception.
ExceptionCodes
Static definitions of error codes.
When thrown, provides information about an error that has occurred inside the engine.
InvalidParametersException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)