ScopedError#

Fully qualified name: carb::ScopedError

Defined in carb/Error.h

class ScopedError#

A helper that keeps a copy of the current Error for the current thread and puts it back when destroyed.

Public Functions

inline ScopedError()#

Constructor. Makes a copy of the current ErrorApi error.

inline ~ScopedError()#

Destructor. Puts the captured ErrorApi error back for the current thread.

inline explicit operator bool() const noexcept#

Bool operator.

Returns:

true if the stored error is NOT empty; false otherwise.

inline ErrorCode get() const#

Retrieves the stored error code.

Returns:

The stored ErrorCode.

inline explicit operator ErrorCode() const#

ErrorCode operator.

Returns:

The stored ErrorCode.

inline cpp::zstring_view getMessage() const#

Message accessor.

Returns:

The message in the stored Error, or an empty zstring_view.

inline operator cpp::zstring_view() const#

zstring_view operator

Returns:

The message in the stored Error, or an empty zstring_view