EasyException
ee::Exception Class Reference

The base class for all exceptions, which is itself is based on std::exception. More...

#include <ee/Exception.hpp>

Inheritance diagram for ee::Exception:

Public Member Functions

 Exception (std::string caller, std::string message, std::vector< ee::Note > infos, OutputFormat format=OutputFormat::EASY_EXCEPTION_OUTPUT_FORMAT) noexcept
 Constructor with caller and message. More...
 
Exceptionoperator<< (const Note &info) noexcept
 Reads an key-value-pair in and stores the values. More...
 
const char * what () const noexceptoverride
 The default method of every exception. More...
 
const std::string & getMessage () const noexcept
 Returns the message of this exception. More...
 
const std::string & getCaller () const noexcept
 Returns the caller of this exception. More...
 
const std::vector< Note > & getNotes () const noexcept
 Returns a list containing the notes. More...
 
const std::optional< std::shared_ptr< Stacktrace > > & getStacktrace () const noexcept
 Returns an optional that can contain a stacktrace. More...
 
const std::chrono::time_point< std::chrono::system_clock > & getDateOfCreation () const noexcept
 Returns the date of creation. More...
 

Private Member Functions

void update () noexcept
 Updates the cache.
 

Private Attributes

OutputFormat mFormat
 Defines the output format of this exception.
 
std::string mMessage
 Holds the base message provided by the caller.
 
std::string mCaller
 Holds the caller.
 
std::vector< NotemInfos
 Holds information stored by key-value pairs.
 
std::optional< std::shared_ptr< Stacktrace > > mStacktrace
 Holds the stacktrace.
 
std::chrono::time_point< std::chrono::system_clock > mTimepoint
 The date and time of the exception.
 
std::string mCache
 Caches the message for what().
 

Detailed Description

The base class for all exceptions, which is itself is based on std::exception.

Constructor & Destructor Documentation

ee::Exception::Exception ( std::string  caller,
std::string  message,
std::vector< ee::Note infos,
OutputFormat  format = OutputFormat::EASY_EXCEPTION_OUTPUT_FORMAT 
)
explicitnoexcept

Constructor with caller and message.

Parameters
callerThe caller of this exception (typically PRETTY_FUNCTION).
messageThe message of this exception.
infosA list of infos

Member Function Documentation

const std::string& ee::Exception::getCaller ( ) const
noexcept

Returns the caller of this exception.

Returns
Caller of this exception.
const std::chrono::time_point<std::chrono::system_clock>& ee::Exception::getDateOfCreation ( ) const
noexcept

Returns the date of creation.

Returns
Date of creation.
const std::string& ee::Exception::getMessage ( ) const
noexcept

Returns the message of this exception.

Returns
Message of this exception.
const std::vector<Note>& ee::Exception::getNotes ( ) const
noexcept

Returns a list containing the notes.

Returns
List containing the notes of this exception.
const std::optional<std::shared_ptr<Stacktrace> >& ee::Exception::getStacktrace ( ) const
noexcept

Returns an optional that can contain a stacktrace.

Returns
An optional that can contain a stacktrace.
Exception& ee::Exception::operator<< ( const Note info)
noexcept

Reads an key-value-pair in and stores the values.

Parameters
infoThe info object that provides the information that will be stored.
Returns
Reference to this.
const char* ee::Exception::what ( ) const
overridenoexcept

The default method of every exception.

Returns
A string representing the error message.

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