OGRE-Next: Ogre::Exception Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Ogre::Exception Class Reference
Core » General

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

`#include <OgreException.h>`

Inheritance diagram for Ogre::Exception:
[legend]

## 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 , ERR_INVALID_CALL }
| Static definitions of error codes. More...

## Public Member Functions
| Exception (const Exception &rhs)
| Copy constructor.
| 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 () noexcept override
| Needed for compatibility with std::exception.
virtual const String & | getDescription () const
| Returns a string with only the 'description' field of this exception.
virtual const String & | getFile () const
| Gets source file name.
virtual const String & | getFullDescription () const
| Returns a string with the full description of this error.
virtual long | getLine () const
| Gets line number.
virtual int | getNumber () const noexcept
| Gets the error code.
virtual const String & | getSource () const
| Gets the source function.
Exception & | operator= (const Exception &rhs)
| Assignment operator.
const char * | what () const noexcept(true) override
| Override std::exception::what.

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

## Member Enumeration Documentation

## ◆ ExceptionCodes

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

## Constructor & Destructor Documentation

## ◆ Exception() [1/3]

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

Default constructor.

Referenced by Exception(), and operator=().

## ◆ Exception() [2/3]

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

Advanced constructor.

## ◆ Exception() [3/3]

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

Copy constructor.

References Exception().

## ◆ ~Exception()

Ogre::Exception::~Exception | ( |  | ) |
| overridenoexcept

Needed for compatibility with std::exception.

## Member Function Documentation

## ◆ getDescription()

virtual const String & Ogre::Exception::getDescription | ( |  | ) | const
| inlinevirtual

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.

## ◆ getFile()

virtual const String & Ogre::Exception::getFile | ( |  | ) | const
| inlinevirtual

Gets source file name.

## ◆ getFullDescription()

virtual const String & Ogre::Exception::getFullDescription | ( |  | ) | 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.

References getFullDescription().

Referenced by getFullDescription(), and what().

## ◆ getLine()

virtual long Ogre::Exception::getLine | ( |  | ) | const
| inlinevirtual

Gets line number.

## ◆ getNumber()

virtual int Ogre::Exception::getNumber | ( |  | ) | const
| virtualnoexcept

Gets the error code.

References getNumber().

Referenced by getNumber().

## ◆ getSource()

virtual const String & Ogre::Exception::getSource | ( |  | ) | const
| inlinevirtual

Gets the source function.

References getSource().

Referenced by getSource().

## ◆ operator=()

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

Assignment operator.

References Exception().

## ◆ what()

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

Override std::exception::what.

References getFullDescription().

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

- OgreException.h