Base exception class. All exceptions thrown in DIPlib are derived of this class.
You can catch this exception at the top level, where you can communicate the problem to the user,
and only if you want to prevent your program from exiting abnormally.
This class is derived from
std::exception, so you can choose to catch that instead.
- class std::exception
- Exception class indicating that an internal inconsistency was found (the library code is wrong).
- Exception class indicating that a function received an inconsistent or out of range parameter (the calling code is wrong).
- Exception class indicating that something happened that we couldn’t predict (e.g. file error).
- auto what() const -> char const* override noexcept
- Return a message indicating what caused the exception to be thrown, as well as the location where the error occurred.
- auto Message() const -> std::string
- Return a message indicating what caused the exception to be thrown, without location information.
- auto AddStackTrace(std::string const& functionName, std::string const& fileName, unsigned int lineNumber) -> dip::Error&
- Add an entry to the stack trace. Typically called through the
- auto IsSet() const -> bool
- Returns true if an error message is set. Use this to distinguish from a default-constructed error.
char const* what() const override noexcept
Return a message indicating what caused the exception to be thrown, as well as the location where the error occurred.
Sometimes multiple locations are given, this is an (incomplete) stack trace that might help figure out the error. Such a stack trace is generally created when it is a helper function that threw the exception. Some calling functions will catch such an exception, add its name to the stack trace, and re-throw the exception.