Corrade::Utility::Fatal class

Fatal output handler.

Equivalent to Error, but exits with defined exit code on destruction. So instead of this:

if(stuff.broken()) {
    Utility::Error{} << "Everything's broken, exiting.";
    std::exit(42);
}

You can write just this:

if(stuff.broken())
    Utility::Fatal{42} << "Everything's broken, exiting.";

Base classes

class Error
Error output handler.

Constructors, destructors, conversion operators

Fatal(int exitCode = 1, Flags flags = {}) explicit
Constructor.
Fatal(Flags flags) explicit
Fatal(std::ostream* output, int exitCode = 1, Flags flags = {}) explicit
Construct with redirection to a stream.
Fatal(std::ostream* output, Flags flags = {}) explicit
Fatal(std::nullptr_t output, int exitCode = 1, Flags flags = {}) explicit
Fatal(std::nullptr_t output, Flags flags = {}) explicit
Fatal(Containers::String* output, int exitCode = 1, Flags flags = {}) explicit new in Git master
Construct with redirection to a string.
Fatal(Containers::String* output, Flags flags = {}) explicit
~Fatal()
Destructor.

Function documentation

Corrade::Utility::Fatal::Fatal(int exitCode = 1, Flags flags = {}) explicit

Constructor.

Parameters
exitCode Application exit code to be used on destruction
flags Output flags

Sets output to std::cerr. The exitCode is passed to std::exit() on destruction.

Corrade::Utility::Fatal::Fatal(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::Fatal::Fatal(std::ostream* output, int exitCode = 1, Flags flags = {}) explicit

Construct with redirection to a stream.

Parameters
output Stream where to put debug output. If set to nullptr, no debug output will be written anywhere.
exitCode Application exit code to be used on destruction
flags Output flags

Corrade::Utility::Fatal::Fatal(std::ostream* 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::Fatal::Fatal(std::nullptr_t output, int exitCode = 1, 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::Fatal::Fatal(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::Fatal::Fatal(Containers::String* output, int exitCode = 1, 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.
exitCode Application exit code to be used on destruction
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::Fatal::Fatal(Containers::String* 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::Fatal::~Fatal()

Destructor.

Exits the application with exit code specified in constructor.