Corrade::Utility::Error class

Error output handler.

Same as Debug, but by default writes output to standard error output. Thus it is possible to separate / mute Debug, Warning and Error outputs.

Base classes

class Debug
Debug output handler.

Derived classes

class Fatal
Fatal output handler.

Public static functions

static auto defaultOutput() -> std::ostream* new in 2019.10
Default error output stream.
static auto output() -> std::ostream*
Current error output stream.
static auto isTty() -> bool
Whether current error output stream is a TTY.

Constructors, destructors, conversion operators

Error(Flags flags = {}) explicit
Default constructor.
Error(std::ostream* output, Flags flags = {}) explicit
Construct with redirection to a stream.
Error(std::nullptr_t output, Flags flags = {}) explicit
Error(Containers::String* output, Flags flags = {}) explicit new in Git master
Construct with redirection to a string.
Error(const Error&) deleted
Copying is not allowed.
Error(Error&&) defaulted
Move constructor.
~Error()
Destructor.

Public functions

auto operator=(const Error&) -> Error& deleted
Copying is not allowed.
auto operator=(Error&&) -> Error& deleted
Move assignment is not allowed.

Function documentation

static std::ostream* Corrade::Utility::Error::defaultOutput() new in 2019.10

Default error output stream.

Error output when no output redirection happens. A pointer to std::cerr.

static std::ostream* Corrade::Utility::Error::output()

Current error output stream.

Error output constructed with the Error(Flags) constructor will be using this output stream.

static bool Corrade::Utility::Error::isTty()

Whether current error output stream is a TTY.

Calls isTty(std::ostream*) with output of enclosing Error instance or with std::cerr if there isn't any.

Corrade::Utility::Error::Error(Flags flags = {}) explicit

Default constructor.

Parameters
flags Output flags

Inherits output of enclosing Error instance or uses std::cerr if there isn't any.

Corrade::Utility::Error::Error(std::ostream* output, Flags flags = {}) explicit

Construct with redirection to a stream.

Parameters
output Stream where to put error output. If set to nullptr, no error output will be written anywhere.
flags Output flags

All new instances created using the default Error() constructor during lifetime of this instance will inherit the output set in output.

Corrade::Utility::Error::Error(std::nullptr_t output, Flags flags = {}) explicit

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Corrade::Utility::Error::Error(Containers::String* output, Flags flags = {}) explicit new in Git master

Construct with redirection to a string.

Parameters
output String where to put debug output. If set to nullptr, no debug output will be written anywhere.
flags Output flags

If output is not nullptr, its existing contents (if any) are appended to. Internally the function allocates a custom std::ostream and frees it again during its own destruction.

Corrade::Utility::Error::~Error()

Destructor.

Resets the output redirection back to the output of enclosing scope. If there was any output, adds newline at the end. Also resets output color modifier, if there was any.