Orxonox: src/util/Exception.h File Reference

# Exception.h File Reference

Declaration of facilities to handle exceptions. More...

`#include "UtilPrereqs.h"`
`#include <exception>`
`#include <sstream>`
`#include <string>`
`#include "Debug.h"`

## Namespaces

namespace | orxonox

## Classes

class | orxonox::Exception
| Base class for all exceptions (derived from std::exception). More...

## Defines

#define | CREATE_ORXONOX_EXCEPTION(ExceptionName)
| Creates a new type of exception that inherits from tracker::Exception.
#define | ThrowException(type, description) throw orxonox::exceptionThrowerHelper(type##Exception(static_cast<std::ostringstream&>(std::ostringstream().flush() << description).str(), __LINE__, __FILE__, __FUNCTIONNAME__))
| Throws an exception and logs a message beforehand.

## Functions

template<class T>
const T & | orxonox::exceptionThrowerHelper (const T &exception)
| Helper function that forwards an exception and displays the message.

## Detailed Description

Declaration of facilities to handle exceptions.

## Define Documentation

#define CREATE_ORXONOX_EXCEPTION | ( | ExceptionName |  | ) |

Value:

    class ExceptionName##Exception : public Exception                               \
        {                                                                               \
        public:                                                                         \
            ExceptionName##Exception(const std::string& description,                    \
                    unsigned int lineNumber, const char* filename,                      \
                    const char* functionName)                                           \
                : Exception(description, lineNumber, filename, functionName)            \
            { }                                                                         \
                                                                                        \
            ExceptionName##Exception(const std::string& description)                    \
                : Exception(description)                                                \
            { }                                                                         \
                                                                                        \
            ~ExceptionName##Exception() throw() { }                                     \
                                                                                        \
            std::string getTypeName() const { return #ExceptionName; }                  \
        }

Creates a new type of exception that inherits from tracker::Exception.

#define ThrowException | ( | type,
|  | description |  | ) | throw orxonox::exceptionThrowerHelper(type##Exception(static_cast<std::ostringstream&>(std::ostringstream().flush() << description).str(), __LINE__, __FILE__, __FUNCTIONNAME__))

Throws an exception and logs a message beforehand.

Parameters:

  | type | Type of the exception as literal (General, Initialisation, etc.)
  | description | Exception description as string

Referenced by orxonox::InputManager::_initialiseKeyboard(), orxonox::CommandLine::_parse(), orxonox::GSClient::activate(), orxonox::GameState::addChild(), orxonox::Backlight::Backlight(), orxonox::BigExplosion::BigExplosion(), orxonox::Camera::Camera(), orxonox::Core::checkDevBuild(), orxonox::CommandLine::checkFullArgument(), orxonox::CommandLine::checkShortcut(), orxonox::Core::createDirectories(), orxonox::ExplosionChunk::ExplosionChunk(), orxonox::QuestManager::findHint(), orxonox::QuestManager::findQuest(), orxonox::CommandLine::getArgument(), orxonox::LocalQuest::getStatus(), orxonox::GlobalQuest::getStatus(), orxonox::GlobalShader::GlobalShader(), orxonox::InputManager::initialise(), orxonox::QuestHint::isActive(), orxonox::Light::Light(), orxonox::GraphicsManager::loadRenderer(), orxonox::NotificationOverlay::NotificationOverlay(), orxonox::CommandLineArgument::parse(), orxonox::ParticleEmitter::ParticleEmitter(), orxonox::GameState::removeChild(), orxonox::WorldEntity::setCollisionTypeStr(), orxonox::Core::setExecutablePath(), orxonox::QuestListener::setQuestId(), orxonox::Game::setStateHierarchy(), and orxonox::WorldEntity::WorldEntity().