- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Ogre::Exception Class Reference

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

`#include <OgreException.h>`

Inheritance diagram for Ogre::Exception:
[legend]

List of all members.

## Public Types
enum | ExceptionCodes { ERR_CANNOT_WRITE_TO_FILE, ERR_INVALID_STATE, 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, const char *type, const char *file, long line)
| Advanced constructor.
| Exception (const Exception &rhs)
| Copy constructor.
| ~Exception () throw ()
| Needed for compatibility with std::exception.
void | operator= (const Exception &rhs)
| Assignment operator.
virtual const String & | getFullDescription (void) const
| Returns a string with the full description of this error.
virtual int | getNumber (void) const throw ()
| Gets the error code.
virtual const String & | getSource () const
| Gets the source function.
virtual const String & | getFile () const
| Gets source file name.
virtual long | getLine () const
| Gets line number.
virtual const String & | getDescription (void) const
| Returns a string with only the 'description' field of this exception.
const char * | what () const throw ()
| Override std::exception::what.
## Protected Attributes
long | line
int | number
String | typeName
String | description
String | source
String | file
String | fullDesc

## 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 86 of file OgreException.h.

## Member Enumeration Documentation

enum Ogre::Exception::ExceptionCodes

Static definitions of error codes.

Enumerator:

  ERR_CANNOT_WRITE_TO_FILE |
  ERR_INVALID_STATE |
  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 102 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,
|  | const char * | type,
|  | const char * | file,
|  | long | line |
| ) |  |  |

Advanced constructor.

Ogre::Exception::Exception | ( | const Exception & | rhs | ) |

Copy constructor.

Ogre::Exception::~Exception | ( |  | ) | throw ()

Needed for compatibility with std::exception.

Definition at line 128 of file OgreException.h.

## Member Function Documentation

void Ogre::Exception::operator= | ( | const Exception & | rhs | ) |

Assignment operator.

virtual const String& Ogre::Exception::getFullDescription | ( | void |  | ) | const`[virtual]`

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.

virtual int Ogre::Exception::getNumber | ( | void |  | ) | const throw ()`[virtual]`

Gets the error code.

virtual const String& Ogre::Exception::getSource | ( | void |  | ) | const`[virtual]`

Gets the source function.

Definition at line 152 of file OgreException.h.

virtual const String& Ogre::Exception::getFile | ( |  | ) | const`[virtual]`

Gets source file name.

Definition at line 156 of file OgreException.h.

virtual long Ogre::Exception::getLine | ( |  | ) | const`[virtual]`

Gets line number.

Definition at line 160 of file OgreException.h.

virtual const String& Ogre::Exception::getDescription | ( | void |  | ) | const`[virtual]`

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 166 of file OgreException.h.

const char* Ogre::Exception::what | ( |  | ) | const throw ()

Override std::exception::what.

Definition at line 169 of file OgreException.h.

## Member Data Documentation

long Ogre::Exception::line`[protected]`

Definition at line 89 of file OgreException.h.

int Ogre::Exception::number`[protected]`

Definition at line 90 of file OgreException.h.

String Ogre::Exception::typeName`[protected]`

Definition at line 91 of file OgreException.h.

String Ogre::Exception::description`[protected]`

Definition at line 92 of file OgreException.h.

String Ogre::Exception::source`[protected]`

Definition at line 93 of file OgreException.h.

String Ogre::Exception::file`[protected]`

Definition at line 94 of file OgreException.h.

String Ogre::Exception::fullDesc`[mutable, protected]`

Definition at line 95 of file OgreException.h.

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

- OgreException.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Mon Jun 16 12:49:37 2008