Home
Base module

Error

Basic error type.

Error

#include <icy/error.h>
struct Error

Defined in src/base/include/icy/error.h:32

Basic error type.

Errors contain an error code, message, and exception pointer.

List of all members

NameKindOwner
operator<<friendDeclared here
errvariableDeclared here
messagevariableDeclared here
exceptionvariableDeclared here
ErrorfunctionDeclared here
ErrorfunctionDeclared here
ErrorfunctionDeclared here
anyfunctionDeclared here
resetfunctionDeclared here
rethrowfunctionDeclared here

Friends

NameDescription
operator<< inline

operator<<

inline

friend inline std::ostream & operator<<(std::ostream & stream, const Error & err)

Defined in src/base/include/icy/error.h:80

Public Attributes

ReturnNameDescription
interr
std::stringmessage
std::exception_ptrexception

err

int err

Defined in src/base/include/icy/error.h:34


message

std::string message

Defined in src/base/include/icy/error.h:35


exception

std::exception_ptr exception

Defined in src/base/include/icy/error.h:36

Public Methods

ReturnNameDescription
Error inlineDefault constructor; initializes all fields to a no-error state.
Error inlineConstructs an error with the given message string.
Error inlineConstructs an error with the given C string message.
boolany const inlineReturns true if any error condition is set (non-zero code, non-empty message, or exception).
voidreset inlineClears all error fields, resetting to a no-error state.
voidrethrow inlineRe-throws the stored exception pointer if one is set. Has no effect if exception is null.

Error

inline

inline Error()

Defined in src/base/include/icy/error.h:39

Default constructor; initializes all fields to a no-error state.


Error

inline

inline Error(const std::string & msg)

Defined in src/base/include/icy/error.h:43

Constructs an error with the given message string.

Parameters

  • msg Human-readable error description.

Error

inline

inline Error(const char * msg)

Defined in src/base/include/icy/error.h:51

Constructs an error with the given C string message.

Parameters

  • msg Human-readable error description.

any

const inline

inline bool any() const

Defined in src/base/include/icy/error.h:59

Returns true if any error condition is set (non-zero code, non-empty message, or exception).

Returns

True if an error is present.


reset

inline

inline void reset()

Defined in src/base/include/icy/error.h:65

Clears all error fields, resetting to a no-error state.


rethrow

inline

inline void rethrow()

Defined in src/base/include/icy/error.h:74

Re-throws the stored exception pointer if one is set. Has no effect if exception is null.