3.2.4. Error.hpp

This file contains the functionality used for reporting errors. In the description of the exceptions we use the standard terminology (see e.g., Exception Safety). If nothing else is specified a thrown exception from MØD provides no exception safety. Any exception thrown from MØD or any dependencies are intended to derive from std::exception, and any exception from MØD derives from Exception. The exceptions are in general only thrown from the outermost interface, and not from within the mod::lib namespace.

3.2.4.1. Class Stacktrace

class Stacktrace

A class encapsulating the current stacktrace at construction time. Stacktraces may not be supported on all platforms.

3.2.4.1.1. Synopsis

Stacktrace(unsigned int frameLimit, unsigned int numSkip)
void print(unsigned int frameLimit, std::ostream &s) const

3.2.4.1.2. Details

Stacktrace(unsigned int frameLimit, unsigned int numSkip)

Capture a stacktrace with at most frameLimit frames and without the first numSkip frames. The frame from the constructor itself is always skipped.

void print(unsigned int frameLimit, std::ostream &s) const

Print at most the first frameLimit frames from the capture stacktrace. Use 0 to print all available frames. Symbol names will be demangled if possible.

3.2.4.2. Class Exception

class Exception : public std::exception

The base class of all MØD exceptions.

3.2.4.2.1. Synopsis

virtual std::string getName() const = 0
virtual const char *what() const noexcept
void printStacktrace(unsigned int frameLimit, std::ostream &s) const
void append(const std::string &text)

3.2.4.2.2. Details

virtual std::string getName() const = 0
Returns:

the name of the exception.

virtual const char *what() const noexcept
Returns:

the description for the exception.

void printStacktrace(unsigned int frameLimit, std::ostream &s) const

Print the stacktrace captured when the exception was constructed. See Stacktrace::print().

void append(const std::string &text)

Append text to the exception message.

3.2.4.3. Class FatalError

class FatalError : public Exception

When thrown there is no exception safety. It is not safe to continue after catching it.

3.2.4.3.1. Synopsis

3.2.4.4. Class InputError

class InputError : public Exception

When thrown there is strong exception safety. This exception is thrown when bad data has been provided to a loading function.

3.2.4.4.1. Synopsis

3.2.4.5. Class LogicError

class LogicError : public Exception

When thrown there is strong exception safety. This exception is thrown when a pre-condition of a function is violated.

3.2.4.5.1. Synopsis

3.2.4.6. Class TermParsingError

class TermParsingError : public Exception

When thrown there is at least basic exception safety. This exception is thrown if LabelType::Term is used and parsing of a string into a first-order term fails.

3.2.4.6.1. Synopsis

3.2.4.7. Class StereoDeductionError

class StereoDeductionError : public Exception

When thrown there is at least basic exception safety. This exception is thrown if stereo data is requested and deduction failed.

3.2.4.7.1. Synopsis