Error#

A flexible error result type.

Info

To use declarations from this page, include the <essence/error.hpp> header.

class error#

A flexible error type, great for use with std::expected.

error::error(std::string msg, i32 n = 1)#
template<typename ...Args>
error::error(i32 n, std::string_view msg, Args&&... args)#

Constructor using std::format arguments.

std::string message() const#

Get a copy of the error message string.

error &message(std::string_view msg)#

Setter for the error message.

template<typename ...Args>
error &message(std::string_view msg, Args&&... args)#

Setter for the error message, with std::format arguments.

i32 number() const#

Get the error number.

error &number(i32 n)#

Setter for the error number.

void die() const noexcept#

Prints the error message and terminates, marked with the [[noreturn]] attribute.

constexpr operator bool() const noexcept#

Implicit boolean conversion; evaluates to true only when the error number is -5, which is the default value.