23 #ifndef FIFTYONE_DEGREES_EXCEPTIONS_H_INCLUDED 24 #define FIFTYONE_DEGREES_EXCEPTIONS_H_INCLUDED 102 #ifndef FIFTYONE_DEGREES_EXCEPTIONS_DISABLED 111 EXTERNAL
typedef struct fiftyone_degrees_exception_t {
122 #define FIFTYONE_DEGREES_EXCEPTION_SET(s) \ 123 if (exception != NULL) { \ 124 exception->file = __FILE__; \ 125 exception->func = __func__; \ 126 exception->line = __LINE__; \ 127 exception->status = s; \ 133 #define FIFTYONE_DEGREES_EXCEPTION_CLEAR \ 134 exception->file = NULL; \ 135 exception->func = NULL; \ 136 exception->line = -1; \ 137 exception->status = FIFTYONE_DEGREES_STATUS_NOT_SET; 142 #define FIFTYONE_DEGREES_EXCEPTION_OKAY \ 143 (exception == NULL || exception->status == FIFTYONE_DEGREES_STATUS_NOT_SET) 145 #ifdef FIFTYONE_DEGREES_EXCEPTIONS_HPP 151 #define FIFTYONE_DEGREES_EXCEPTION_THROW \ 152 if (FIFTYONE_DEGREES_EXCEPTION_OKAY == false) { \ 153 throw FiftyoneDegrees::Common::FatalException(exception); \ 161 #define FIFTYONE_DEGREES_EXCEPTION_THROW \ 162 fiftyoneDegreesExceptionCheckAndExit(exception); 170 #define FIFTYONE_DEGREES_EXCEPTION_CLEAR exception = NULL; 172 #define FIFTYONE_DEGREES_EXCEPTION_SET(s) exception = NULL; 174 #define FIFTYONE_DEGREES_EXCEPTION_OKAY (exception == exception) 176 #define FIFTYONE_DEGREES_EXCEPTION_THROW 183 #define FIFTYONE_DEGREES_EXCEPTION_CREATE \ 184 fiftyoneDegreesException exceptionValue; \ 185 fiftyoneDegreesException *exception = &exceptionValue; \ 186 FIFTYONE_DEGREES_EXCEPTION_CLEAR 191 #define FIFTYONE_DEGREES_EXCEPTION_FAILED \ 192 (FIFTYONE_DEGREES_EXCEPTION_OKAY == false) const char * func
Function generating the exception.
Definition: exceptions.h:113
fiftyoneDegreesStatusCode status
Status code to assign.
Definition: exceptions.h:115
fiftyoneDegreesStatusCode
Status returned from the initialisation of a resource.
Definition: status.h:77
int line
Line number generating the exception.
Definition: exceptions.h:114
void fiftyoneDegreesExceptionCheckAndExit(fiftyoneDegreesException *exception)
If the exception is set then will print a message to stderr and exit the process.
const char * file
File generating the exception.
Definition: exceptions.h:112
const char * fiftyoneDegreesExceptionGetMessage(fiftyoneDegreesException *exception)
Returns an English error message for the exception.
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:111