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();
167 const char*
what()
const throw() {
return getFullDescription().c_str(); }
181 enum { number = num };
191 :
Exception(inNumber, inDescription, inSource,
"UnimplementedException", inFile, inLine) {}
197 :
Exception(inNumber, inDescription, inSource,
"FileNotFoundException", inFile, inLine) {}
203 :
Exception(inNumber, inDescription, inSource,
"IOException", inFile, inLine) {}
209 :
Exception(inNumber, inDescription, inSource,
"InvalidStateException", inFile, inLine) {}
215 :
Exception(inNumber, inDescription, inSource,
"InvalidParametersException", inFile, inLine) {}
221 :
Exception(inNumber, inDescription, inSource,
"ItemIdentityException", inFile, inLine) {}
227 :
Exception(inNumber, inDescription, inSource,
"InternalErrorException", inFile, inLine) {}
233 :
Exception(inNumber, inDescription, inSource,
"RenderingAPIException", inFile, inLine) {}
239 :
Exception(inNumber, inDescription, inSource,
"RuntimeAssertionException", inFile, inLine) {}
261 const String& src,
const char* file,
long line)
268 const String& src,
const char* file,
long line)
275 const String& src,
const char* file,
long line)
282 const String& src,
const char* file,
long line)
289 const String& src,
const char* file,
long line)
296 const String& src,
const char* file,
long line)
303 const String& src,
const char* file,
long line)
310 const String& src,
const char* file,
long line)
317 const String& src,
const char* file,
long line)
324 const String& src,
const char* file,
long line)
334 #define OGRE_EXCEPT(num, desc, src) throw Ogre::ExceptionFactory::create( \ 335 Ogre::ExceptionCodeType<num>(), desc, src, __FILE__, __LINE__ );
static RuntimeAssertionException create(ExceptionCodeType< Exception::ERR_RT_ASSERTION_FAILED > code, const String &desc, const String &src, const char *file, long line)
static ItemIdentityException create(ExceptionCodeType< Exception::ERR_ITEM_NOT_FOUND > code, const String &desc, const String &src, const char *file, long line)
~Exception()
Needed for compatibility with std::exception.
static FileNotFoundException create(ExceptionCodeType< Exception::ERR_FILE_NOT_FOUND > code, const String &desc, const String &src, const char *file, long line)
static RenderingAPIException create(ExceptionCodeType< Exception::ERR_RENDERINGAPI_ERROR > code, const String &desc, const String &src, const char *file, long line)
virtual long getLine() const
Gets line number.
RenderingAPIException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
static InvalidParametersException create(ExceptionCodeType< Exception::ERR_INVALIDPARAMS > code, const String &desc, const String &src, const char *file, long line)
Class implementing dispatch methods in order to construct by-value exceptions of a derived type based...
When thrown, provides information about an error that has occurred inside the engine.
InternalErrorException(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 ItemIdentityException create(ExceptionCodeType< Exception::ERR_DUPLICATE_ITEM > code, const String &desc, const String &src, const char *file, long line)
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.
ExceptionFactory()
Private constructor, no construction.
InvalidStateException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
IOException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
virtual const String & getFile() const
Gets source file name.
virtual const String & getSource() const
Gets the source function.
ExceptionCodes
Static definitions of error codes.
This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info...
static IOException create(ExceptionCodeType< Exception::ERR_CANNOT_WRITE_TO_FILE > code, const String &desc, const String &src, const char *file, long line)
static InvalidStateException create(ExceptionCodeType< Exception::ERR_INVALID_STATE > code, 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)
RuntimeAssertionException(int inNumber, const String &inDescription, const String &inSource, const char *inFile, long inLine)
static UnimplementedException create(ExceptionCodeType< Exception::ERR_NOT_IMPLEMENTED > code, const String &desc, const String &src, const char *file, long line)
Template struct which creates a distinct type for each exception code.
InvalidParametersException(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)
static InternalErrorException create(ExceptionCodeType< Exception::ERR_INTERNAL_ERROR > code, const String &desc, const String &src, const char *file, long line)