Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::Exception Class Reference

When thrown, provides information about an error that has occurred inside the engine. More...

#include <OgreException.h>

List of all members.

Public Types

enum  ExceptionCodes {
  UNIMPLEMENTED_FEATURE, ERR_CANNOT_WRITE_TO_FILE, ERR_NO_RENDERSYSTEM_SELECTED, ERR_DIALOG_OPEN_ERROR,
  ERR_INVALIDPARAMS, ERR_RENDERINGAPI_ERROR, ERR_DUPLICATE_ITEM, ERR_ITEM_NOT_FOUND,
  ERR_FILE_NOT_FOUND, ERR_INTERNAL_ERROR, ERR_RT_ASSERTION_FAILED, ERR_NOT_IMPLEMENTED
}
 Static definitions of error codes. More...


Public Member Functions

 Exception (int number, const String &description, const String &source)
 Default constructor.

 Exception (int number, const String &description, const String &source, char *file, long line)
 Advanced constructor.

 Exception (const Exception &rhs)
 Copy constructor.

void operator= (const Exception &rhs)
 Assignment operator.

String getFullDescription (void) const
 Returns a string with the full description of this error.

int getNumber (void) const throw ()
 Gets the error code.

const StringgetSource () const
 Gets the source function.

const StringgetFile () const
 Gets source file name.

long getLine () const
 Gets line number.

const StringgetDescription (void) const
 Returns a string with only the 'description' field of this exception.


Static Public Member Functions

ExceptiongetLastException (void) throw ()
 Retrieves a pointer to the last exception created.

void _pushFunction (const String &strFuncName) throw ()
 Pushes a function on the stack.

void _popFunction () throw ()
 Pops a function from the stack.


Protected Attributes

long line
int number
String description
String source
String file
ushort stackDepth

Static Protected Attributes

Exceptionlast
String msFunctionStack [OGRE_CALL_STACK_DEPTH]
ushort msStackDepth


Detailed Description

When thrown, provides information about an error that has occurred inside the engine.

Remarks:
OGRE never uses return values to indicate errors. Instead, if an error occurs, an exception is thrown, and this is the object that encapsulates the detail of the problem. The application using OGRE should always ensure that the exceptions are caught, so all OGRE engine functions should occur within a try{} catch(Ogre::Exception& e) {} block.
The user application should never create any instances of this object unless it wishes to unify its error handling using the same object.

Definition at line 105 of file OgreException.h.


Member Enumeration Documentation

enum Ogre::Exception::ExceptionCodes
 

Static definitions of error codes.

Todo:
Add many more exception codes, since we want the user to be able to catch most of them.
Enumeration values:
UNIMPLEMENTED_FEATURE 
ERR_CANNOT_WRITE_TO_FILE 
ERR_NO_RENDERSYSTEM_SELECTED 
ERR_DIALOG_OPEN_ERROR 
ERR_INVALIDPARAMS 
ERR_RENDERINGAPI_ERROR 
ERR_DUPLICATE_ITEM 
ERR_ITEM_NOT_FOUND 
ERR_FILE_NOT_FOUND 
ERR_INTERNAL_ERROR 
ERR_RT_ASSERTION_FAILED 
ERR_NOT_IMPLEMENTED 

Definition at line 124 of file OgreException.h.


Constructor & Destructor Documentation

Ogre::Exception::Exception int  number,
const String description,
const String source
 

Default constructor.

Ogre::Exception::Exception int  number,
const String description,
const String source,
char *  file,
long  line
 

Advanced constructor.

Ogre::Exception::Exception const Exception rhs  ) 
 

Copy constructor.


Member Function Documentation

void Ogre::Exception::_popFunction  )  throw () [static]
 

Pops a function from the stack.

void Ogre::Exception::_pushFunction const String strFuncName  )  throw () [static]
 

Pushes a function on the stack.

const String& Ogre::Exception::getDescription void   )  const
 

Returns a string with only the 'description' field of this exception.

Use getFullDescriptionto get a full description of the error including line number, error number and what function threw the exception.

Definition at line 187 of file OgreException.h.

References Ogre::String.

const String& Ogre::Exception::getFile  )  const
 

Gets source file name.

Definition at line 177 of file OgreException.h.

References Ogre::String.

String Ogre::Exception::getFullDescription void   )  const
 

Returns a string with the full description of this error.

Remarks:
The description contains the error number, the description supplied by the thrower, what routine threw the exception, and will also supply extra platform-specific information where applicable. For example - in the case of a rendering library error, the description of the error will include both the place in which OGRE found the problem, and a text description from the 3D rendering library, if available.

Exception* Ogre::Exception::getLastException void   )  throw () [static]
 

Retrieves a pointer to the last exception created.

long Ogre::Exception::getLine  )  const
 

Gets line number.

Definition at line 181 of file OgreException.h.

int Ogre::Exception::getNumber void   )  const throw ()
 

Gets the error code.

const String& Ogre::Exception::getSource void   )  const
 

Gets the source function.

Definition at line 173 of file OgreException.h.

References Ogre::String.

void Ogre::Exception::operator= const Exception rhs  ) 
 

Assignment operator.


Member Data Documentation

String Ogre::Exception::description [protected]
 

Definition at line 110 of file OgreException.h.

String Ogre::Exception::file [protected]
 

Definition at line 112 of file OgreException.h.

Exception* Ogre::Exception::last [static, protected]
 

Definition at line 114 of file OgreException.h.

long Ogre::Exception::line [protected]
 

Definition at line 108 of file OgreException.h.

String Ogre::Exception::msFunctionStack[ OGRE_CALL_STACK_DEPTH ] [static, protected]
 

Definition at line 116 of file OgreException.h.

ushort Ogre::Exception::msStackDepth [static, protected]
 

Definition at line 117 of file OgreException.h.

int Ogre::Exception::number [protected]
 

Definition at line 109 of file OgreException.h.

String Ogre::Exception::source [protected]
 

Definition at line 111 of file OgreException.h.

ushort Ogre::Exception::stackDepth [protected]
 

Definition at line 113 of file OgreException.h.


The documentation for this class was generated from the following file:

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:38:50 2006