diplib/library/error.h file

Defines error macros and default error strings. This file is always included through diplib.h. See Error management.

Contents

Classes

class dip::Error
Base exception class. All exceptions thrown in DIPlib are derived of this class.
class dip::AssertionError
Exception class indicating that an internal inconsistency was found (the library code is wrong).
class dip::ParameterError
Exception class indicating that a function received an inconsistent or out of range parameter (the calling code is wrong).
class dip::RunTimeError
Exception class indicating that something happened that we couldn’t predict (e.g. file error).

Macros

#define DIP_ADD_STACK_TRACE
Adds information from current function (including source file and location within file) to the dip::Error.
#define DIP_THROW
Throw a dip::ParameterError.
#define DIP_THROW_INVALID_FLAG
Throw a dip::ParameterError that reads “Invalid flag: “.
#define DIP_THROW_IF
Test a condition, throw a dip::ParameterError if the condition is met.
#define DIP_THROW_RUNTIME
Throw a dip::RunTimeError.
#define DIP_THROW_ASSERTION
Throw a dip::AssertionError.
#define DIP_ASSERT
Test a condition, throw a dip::AssertionError if the condition is not met.
#define DIP_START_STACK_TRACE
Starts a try/catch block that builds a stack trace when an exception is thrown.
#define DIP_END_STACK_TRACE
Ends a try/catch block that builds a stack trace when an exception is thrown. See DIP_START_STACK_TRACE.
#define DIP_STACK_TRACE_THIS
Encapsulates a statement in a try/catch block that builds a stack trace when an exception is thrown.