Rodin::Alert::Exception class

Exception class with formatted output capabilities.

A specialized exception class that extends both std::exception and the Alert messaging system. When raised, it outputs a formatted error message with red coloring and terminates the program.

The Exception class provides stream-like insertion operators for building detailed error messages with formatting capabilities.

Base classes

template<class Prefix>
class Message<ExceptionPrefix>
Base class for objects which represents output messages.

Derived classes

template<class T, class FuncName>
class MemberFunctionException
Exception type for errors occurring in member functions.

Public types

using Parent = Message<ExceptionPrefix>
Parent class type alias.

Constructors, destructors, conversion operators

Exception()
Constructs an Exception with an empty message.
Exception(std::ostream& os)
Constructs an Exception with a specific output stream.
Exception(const Exception& other)
Copy constructor.
Exception(Exception&& other)
Move constructor.

Public functions

auto raise() const -> void override
Raises the exception to the user.
auto what() const -> const char* override noexcept
Returns the exception message.

Function documentation

Rodin::Alert::Exception::Exception()

Constructs an Exception with an empty message.

Creates an exception that outputs to std::cerr by default.

Rodin::Alert::Exception::Exception(std::ostream& os)

Constructs an Exception with a specific output stream.

Parameters
os The output stream to write the error message to.

Rodin::Alert::Exception::Exception(const Exception& other)

Copy constructor.

Parameters
other The Exception object to copy from.

Rodin::Alert::Exception::Exception(Exception&& other)

Move constructor.

Parameters
other The Exception object to move from.

void Rodin::Alert::Exception::raise() const override

Raises the exception to the user.

Outputs a formatted error message to the configured stream and terminates the program by calling std::abort(). The message includes the exception prefix and any accumulated message content.

const char* Rodin::Alert::Exception::what() const override noexcept

Returns the exception message.

Returns A C-style string containing the exception message.

This method provides compatibility with std::exception::what().