fire v0.19.0
Framework for sImulation and Reconstruction of Events
fire::Exception Class Reference

Standard base exception class with some useful output information. More...

#include <Exception.h>

Inheritance diagram for fire::Exception:
[legend]
Collaboration diagram for fire::Exception:
[legend]

Public Member Functions

 Exception () noexcept
 Empty constructor. More...
 
 Exception (const std::string &cat, const std::string &msg, bool build_trace=true) noexcept
 Class constructor. More...
 
virtual ~Exception ()=default
 Class destructor.
 
const std::stringcategory () const noexcept
 get the category of this exception More...
 
const std::stringmessage () const noexcept
 Get the message of the exception. More...
 
const std::stringtrace () const noexcept
 Get the stack trace. More...
 
virtual const char * what () const noexcept override
 The error message. More...
 
- Public Member Functions inherited from std::exception
what (T... args)
 
~exception (T... args)
 
operator= (T... args)
 
exception (T... args)
 

Private Attributes

std::string category_
 the category of this exception
 
std::string message_
 the error message to print with this exception
 
std::string stack_trace_
 the stored stack trace at the throw point (if created)
 

Detailed Description

Standard base exception class with some useful output information.

This is the Exception calss that the executable expects and can print easily.

Constructor & Destructor Documentation

◆ Exception() [1/2]

fire::Exception::Exception ( )
inlinenoexcept

Empty constructor.

Don't build stack trace for empty exceptions.

◆ Exception() [2/2]

fire::Exception::Exception ( const std::string cat,
const std::string msg,
bool  build_trace = true 
)
noexcept

Class constructor.

Here is where the category of this exception and its message are defined. The user is also given the option to turn off the building of the stack trace.

Parameters
[in]catcategory of this exception
[in]messagemessage describing the exception.
[in]build_tracetrue if we want the stack trace to be built

Member Function Documentation

◆ category()

const std::string & fire::Exception::category ( ) const
inlinenoexcept

get the category of this exception

Returns
the category for this exception

◆ message()

const std::string & fire::Exception::message ( ) const
inlinenoexcept

Get the message of the exception.

Returns
The message of the exception.

◆ trace()

const std::string & fire::Exception::trace ( ) const
inlinenoexcept

Get the stack trace.

The stack trace is only built if the build_trace argument to the constructor was true, so this might return an empty string.

Returns
stack trace in the form of a string

◆ what()

virtual const char * fire::Exception::what ( ) const
inlineoverridevirtualnoexcept

The error message.

Returns
The error message.

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