20 #ifndef MIRTK_Exception_H 21 #define MIRTK_Exception_H 23 #include "mirtk/String.h" 24 #include "mirtk/Stream.h" 36 ERR_InvalidArgument = 3,
40 ERR_NotImplemented = 42
49 case ERR_None: { str =
"NoError"; }
break;
50 case ERR_Unknown: { str =
"UnknownError"; }
break;
51 case ERR_LogicError: { str =
"LogicError"; }
break;
52 case ERR_InvalidArgument: { str =
"InvalidArgument"; }
break;
53 case ERR_RuntimeError: { str =
"RuntimeError"; }
break;
54 case ERR_IOError: { str =
"IOError"; }
break;
55 case ERR_Memory: { str =
"MemoryError"; }
break;
56 case ERR_NotImplemented: { str =
"NotImplemented"; }
break;
73 template <
typename... Args>
76 Print(cerr, err,
": ", func,
": ", args...);
78 exit(static_cast<int>(err));
84 #endif // MIRTK_Exception_H
string ToString(const EnergyMeasure &value, int w, char c, bool left)
Convert energy measure enumeration value to string.
void Throw(ErrorType err, const char *func, Args... args)
std::ostream & Print(std::ostream &os, T value)
Print single argument to output stream.
ErrorType
Enumeration of error types / exit codes.