Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound 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 }
| Static definitions of error codes. More...

## Public Methods

| 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.
String | getFile ()
| Gets source file name.
long | getLine ()
| Gets line number.

## Static Public Methods

Exception * | getLastException (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

Exception * | last = NULL
OgreChar | msFunctionStack [OGRE_CALL_STACK_DEPTH][256]
ushort | msStackDepth = 0

## 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 |

Definition at line 124 of file OgreException.h.

## Constructor & Destructor Documentation

Ogre::Exception::Exception | ( | int | number,
|  | const String & | description,
|  | const String & | source
| ) |

| Default constructor. Definition at line 42 of file OgreException.cpp. References last, and Ogre::String.

Ogre::Exception::Exception | ( | int | number,
|  | const String & | description,
|  | const String & | source,
|  | char * | file,
|  | long | line
| ) |

| Advanced constructor. Definition at line 56 of file OgreException.cpp. References last, Ogre::LML_CRITICAL, and Ogre::String.

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

| Copy constructor. Definition at line 72 of file OgreException.cpp.

## Member Function Documentation

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

| Pops a function from the stack. Definition at line 156 of file OgreException.cpp.

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

| Pushes a function on the stack. Definition at line 148 of file OgreException.cpp. References OGRE_CALL_STACK_DEPTH, and Ogre::String.

String Ogre::Exception::getFile | ( |  | ) |

| Gets source file name. Definition at line 172 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.

Definition at line 86 of file OgreException.cpp.

References description, file, line, msFunctionStack, number, OGRE_CALL_STACK_DEPTH, source, stackDepth, Ogre::String, and Ogre::ushort.

Referenced by Ogre::handleTerminate().

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

| Retrieves a pointer to the last exception created. Definition at line 142 of file OgreException.cpp.

long Ogre::Exception::getLine | ( |  | ) |

| Gets line number. Definition at line 176 of file OgreException.h.

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

| Gets the error code. Definition at line 137 of file OgreException.cpp.

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

| Assignment operator. Definition at line 77 of file OgreException.cpp. References description, file, line, number, and source.

## Member Data Documentation

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

| Definition at line 110 of file OgreException.h. Referenced by getFullDescription(), and operator=().

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

| Definition at line 112 of file OgreException.h. Referenced by getFullDescription(), and operator=().

Exception * Ogre::Exception::last = NULL`[static, protected]`

| Definition at line 37 of file OgreException.cpp. Referenced by Exception().

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

| Definition at line 108 of file OgreException.h. Referenced by getFullDescription(), and operator=().

OgreChar Ogre::Exception::msFunctionStack`[static, protected]`

| Definition at line 39 of file OgreException.cpp. Referenced by getFullDescription().

ushort Ogre::Exception::msStackDepth = 0`[static, protected]`

| Definition at line 40 of file OgreException.cpp.

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

| Definition at line 109 of file OgreException.h. Referenced by getFullDescription(), and operator=().

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

| Definition at line 111 of file OgreException.h. Referenced by getFullDescription(), and operator=().

ushort Ogre::Exception::stackDepth`[protected]`

| Definition at line 113 of file OgreException.h. Referenced by getFullDescription().

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

- OgreException.h
- OgreException.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:50:56 2004