TuringSim
C++ framework to simulate abstract computing models
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TuringSim::Utils::MessageException Class Reference

The Base class for all custom exceptions. More...

#include <utils/messageException.h>

Inheritance diagram for TuringSim::Utils::MessageException:
Inheritance graph
[legend]
Collaboration diagram for TuringSim::Utils::MessageException:
Collaboration graph
[legend]

Public Member Functions

 MessageException ()=delete
 a message exception must have an explicative message.
 
 MessageException (std::string message) noexcept
 Builds a MessageException with a message. More...
 
 MessageException (const MessageException &e)=default
 Copy constructor. More...
 
 MessageException (MessageException &&e)=default
 Move constructor. More...
 
 ~MessageException () noexcept override=default
 Destructor.
 
std::string getMessage () const
 Get the full error message. More...
 
const char * what () const noexcept override
 Get the full error message. More...
 
 operator std::string () const
 Get the full error message. More...
 

Protected Member Functions

virtual std::string makeFullMessage () const
 Build the full error message. It should be overridden by derived class that adds data to the exception. More...
 

Protected Attributes

std::string msg
 The error message.
 
std::optional< std::string > fullMsg
 The optional full message. Empty until first request.
 

Detailed Description

The Base class for all custom exceptions.

It performs memoization of error message.

Definition at line 12 of file messageException.h.

Constructor & Destructor Documentation

◆ MessageException() [1/3]

TuringSim::Utils::MessageException::MessageException ( std::string  message)
inlinenoexcept

Builds a MessageException with a message.

Parameters
[in]messagethe message describing the problem.

Definition at line 21 of file messageException.h.

◆ MessageException() [2/3]

TuringSim::Utils::MessageException::MessageException ( const MessageException e)
default

Copy constructor.

Parameters
[in]ethe exception to copy.

◆ MessageException() [3/3]

TuringSim::Utils::MessageException::MessageException ( MessageException &&  e)
default

Move constructor.

Parameters
[in]ethe exception to move.

Member Function Documentation

◆ getMessage()

std::string TuringSim::Utils::MessageException::getMessage ( ) const
inline

Get the full error message.

Returns
the error message.

Definition at line 40 of file messageException.h.

Here is the caller graph for this function:

◆ makeFullMessage()

virtual std::string TuringSim::Utils::MessageException::makeFullMessage ( ) const
inlineprotectedvirtual

◆ operator std::string()

TuringSim::Utils::MessageException::operator std::string ( ) const
inlineexplicit

Get the full error message.

Returns
the error message.

Definition at line 56 of file messageException.h.

Here is the call graph for this function:

◆ what()

const char* TuringSim::Utils::MessageException::what ( ) const
inlineoverridenoexcept

Get the full error message.

Returns
the error message.

Definition at line 48 of file messageException.h.


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