Elements  6.2
A C++ base framework for the Euclid Software.
Classes | Public Member Functions | Protected Attributes | List of all members

Elements base exception class. More...

#include <Exception.h>

Inheritance diagram for Elements::Exception:
Inheritance graph
[legend]
Collaboration diagram for Elements::Exception:
Collaboration graph
[legend]

Classes

struct  ExitCodeHelper
 
struct  ExitCodeHelper< First, Rest... >
 
struct  ExitCodeHelper< Last >
 

Public Member Functions

 Exception (ExitCode e=ExitCode::NOT_OK)
 
 Exception (const char *message, ExitCode e=ExitCode::NOT_OK)
 
 Exception (const std::string &message, ExitCode e=ExitCode::NOT_OK)
 
template<typename... Args>
 Exception (const char *stringFormat, Args &&... args)
 Constructs a new Exception with a message using format specifiers. More...
 
virtual ~Exception () noexcept=default
 
const char * what () const noexcept override
 
ExitCode exitCode () const noexcept
 
template<typename T >
void appendMessage (const T &message)
 Appends in the end of the exception message the parameter. More...
 
- Public Member Functions inherited from std::exception
what (T... args)
 
~exception (T... args)
 
operator= (T... args)
 
exception (T... args)
 

Protected Attributes

std::string m_error_msg {}
 
const ExitCode m_exit_code {ExitCode::NOT_OK}
 

Detailed Description

Elements base exception class.

Definition at line 47 of file Exception.h.

Constructor & Destructor Documentation

◆ Exception() [1/4]

Elements::Exception::Exception ( ExitCode  e = ExitCode::NOT_OK)
inlineexplicit

Default constructor. The message is set to the empty string.

Parameters
ethis is an optional exit code. By default is is set to NOT_OK.

Definition at line 54 of file Exception.h.

References Elements::Kernel::Units::e.

◆ Exception() [2/4]

Elements::Exception::Exception ( const char *  message,
ExitCode  e = ExitCode::NOT_OK 
)
inlineexplicit

Constructor (C strings).

Parameters
messageC-style string error message. The string contents are copied upon construction. Hence, responsibility for deleting the char* lies with the caller.
ethis is an optional exit code. By default is is set to NOT_OK.

Definition at line 64 of file Exception.h.

References Elements::Kernel::Units::e.

◆ Exception() [3/4]

Elements::Exception::Exception ( const std::string message,
ExitCode  e = ExitCode::NOT_OK 
)
inlineexplicit

Constructor (C++ STL strings).

Parameters
messageThe error message.
ethis is an optional exit code. By default is is set to NOT_OK.

Definition at line 71 of file Exception.h.

References Elements::Kernel::Units::e.

◆ Exception() [4/4]

template<typename... Args>
Elements::Exception::Exception ( const char *  stringFormat,
Args &&...  args 
)
inlineexplicit

Constructs a new Exception with a message using format specifiers.

Parameters
stringFormatThe message containing the format specifiers
argsThe values to replace the format specifiers with

Definition at line 81 of file Exception.h.

◆ ~Exception()

virtual Elements::Exception::~Exception ( )
virtualdefaultnoexcept

Virtual destructor.

Member Function Documentation

◆ appendMessage()

template<typename T >
void Elements::Exception::appendMessage ( const T &  message)
inline

Appends in the end of the exception message the parameter.

The passed parameters can be of any type the << operator of the std::stringstream can handle.

Parameters
messageThe message to append

Definition at line 118 of file Exception.h.

References std::stringstream::str().

Here is the call graph for this function:

◆ exitCode()

ExitCode Elements::Exception::exitCode ( ) const
inlinenoexcept

Return the exit code of the Exception

Returns
the exit code

Definition at line 106 of file Exception.h.

Referenced by Elements::ProgramManager::onTerminate().

◆ what()

const char* Elements::Exception::what ( ) const
inlineoverridenoexcept

Returns a pointer to the (constant) error description.

Returns
A pointer to a const char *. The underlying memory is in possession of the Exception object. Callers must not attempt to free the memory.

Definition at line 98 of file Exception.h.

Referenced by Elements::ProgramManager::onTerminate().

Member Data Documentation

◆ m_error_msg

std::string Elements::Exception::m_error_msg {}
protected

Error message.

Definition at line 127 of file Exception.h.

◆ m_exit_code

const ExitCode Elements::Exception::m_exit_code {ExitCode::NOT_OK}
protected

Definition at line 128 of file Exception.h.


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