Base class for all MITK exceptions.
More...
#include <mitkException.h>
|
| | Exception (const char *file, unsigned int lineNumber=0, const char *desc="None", const char *loc="Unknown") |
| | Construct an exception with source location and description. More...
|
| |
| | ~Exception () override throw () |
| | Destructor. More...
|
| |
| virtual const char * | GetClassName () const |
| |
| void | AddRethrowData (const char *file, unsigned int lineNumber, const char *message) |
| | Record additional rethrow context for this exception. More...
|
| |
| int | GetNumberOfRethrows () |
| | Return the number of times this exception has been rethrown. More...
|
| |
| void | GetRethrowData (int rethrowNumber, std::string &file, int &line, std::string &message) |
| | Retrieve the rethrow context for a specific rethrow. More...
|
| |
| template<class T > |
| Exception & | operator<< (const T &data) |
| | Append data to the exception description via the stream operator. More...
|
| |
| template<class T > |
| Exception & | operator<< (T &data) |
| | Append non-const data to the exception description via the stream operator. More...
|
| |
| Exception & | operator<< (std::ostream &(*func)(std::ostream &)) |
| | Append a stream manipulator (e.g. std::endl) to the exception description. More...
|
| |
Base class for all MITK exceptions.
Extends itk::ExceptionObject with support for rethrow tracking and stream-style message composition. Do not instantiate this class directly; use the exception macros defined in mitkExceptionMacro.h instead.
Simple usage:
#define mitkThrow()
Throw a generic mitk::Exception with source location information.
To define a specialized exception, inherit from this class and use the mitkExceptionClassMacro:
{
public:
};
Base class for all MITK exceptions.
#define mitkExceptionClassMacro(ClassName, SuperClassName)
Convenience macro for defining MITK exception subclasses.
Throw specialized exceptions with:
#define mitkThrowException(classname)
Throw a specialized exception derived from mitk::Exception.
- See also
- mitkThrow, mitkReThrow, mitkThrowException, mitkExceptionClassMacro
Definition at line 52 of file mitkException.h.
◆ Exception()
| mitk::Exception::Exception |
( |
const char * |
file, |
|
|
unsigned int |
lineNumber = 0, |
|
|
const char * |
desc = "None", |
|
|
const char * |
loc = "Unknown" |
|
) |
| |
|
inline |
Construct an exception with source location and description.
- Parameters
-
| [in] | file | Source file where the exception was thrown. |
| [in] | lineNumber | Line number in the source file. |
| [in] | desc | Human-readable description of the error. |
| [in] | loc | Location string (typically the function name via ITK_LOCATION). |
Definition at line 62 of file mitkException.h.
◆ ~Exception()
| mitk::Exception::~Exception |
( |
| ) |
|
| throw | ( | |
| ) | | |
|
inlineoverride |
◆ AddRethrowData()
| void mitk::Exception::AddRethrowData |
( |
const char * |
file, |
|
|
unsigned int |
lineNumber, |
|
|
const char * |
message |
|
) |
| |
Record additional rethrow context for this exception.
Each call appends a new rethrow record. Use the mitkReThrow macro instead of calling this directly.
- Parameters
-
| [in] | file | Source file where the rethrow occurred. |
| [in] | lineNumber | Line number of the rethrow. |
| [in] | message | Descriptive message for the rethrow. |
- See also
- mitkReThrow, GetNumberOfRethrows, GetRethrowData
◆ GetClassName()
| virtual const char* mitk::Exception::GetClassName |
( |
| ) |
const |
|
virtual |
◆ GetNumberOfRethrows()
| int mitk::Exception::GetNumberOfRethrows |
( |
| ) |
|
Return the number of times this exception has been rethrown.
- Returns
- The rethrow count (0 if the exception was never rethrown).
◆ GetRethrowData()
| void mitk::Exception::GetRethrowData |
( |
int |
rethrowNumber, |
|
|
std::string & |
file, |
|
|
int & |
line, |
|
|
std::string & |
message |
|
) |
| |
Retrieve the rethrow context for a specific rethrow.
If rethrowNumber is out of range (negative or >= GetNumberOfRethrows()), the output parameters are set to empty/zero values.
- Parameters
-
| [in] | rethrowNumber | Zero-based index of the rethrow to query. |
| [out] | file | Filled with the source file of the specified rethrow. |
| [out] | line | Filled with the line number of the specified rethrow. |
| [out] | message | Filled with the message of the specified rethrow. |
- See also
- AddRethrowData, GetNumberOfRethrows
◆ operator<<() [1/3]
template<class T >
| Exception& mitk::Exception::operator<< |
( |
const T & |
data | ) |
|
|
inline |
Append data to the exception description via the stream operator.
- Template Parameters
-
| T | Type of the data to append (must be streamable to std::ostream). |
- Parameters
-
| [in] | data | The data to append to the description string. |
- Returns
- Reference to this exception for chaining.
Definition at line 113 of file mitkException.h.
◆ operator<<() [2/3]
| Exception& mitk::Exception::operator<< |
( |
std::ostream &(*)(std::ostream &) |
func | ) |
|
|
inline |
Append a stream manipulator (e.g. std::endl) to the exception description.
- Parameters
-
| [in] | func | A stream manipulator function pointer. |
- Returns
- Reference to this exception for chaining.
Definition at line 141 of file mitkException.h.
◆ operator<<() [3/3]
template<class T >
| Exception& mitk::Exception::operator<< |
( |
T & |
data | ) |
|
|
inline |
Append non-const data to the exception description via the stream operator.
- Template Parameters
-
| T | Type of the data to append (must be streamable to std::ostream). |
- Parameters
-
| [in] | data | The data to append to the description string. |
- Returns
- Reference to this exception for chaining.
Definition at line 128 of file mitkException.h.
◆ m_RethrowData
| std::vector<ReThrowData> mitk::Exception::m_RethrowData |
|
protected |
The documentation for this class was generated from the following file: