16 #ifndef FIFTYONE_DEGREES_EXCEPTIONS_H_INCLUDED 17 #define FIFTYONE_DEGREES_EXCEPTIONS_H_INCLUDED 95 #define EXTERNAL extern "C" 100 #ifndef FIFTYONE_DEGREES_EXCEPTIONS_DISABLED 109 EXTERNAL
typedef struct fiftyone_degrees_exception_t {
120 #define FIFTYONE_DEGREES_EXCEPTION_SET(s) \ 121 if (exception != NULL) { \ 122 exception->file = __FILE__; \ 123 exception->func = __func__; \ 124 exception->line = __LINE__; \ 125 exception->status = s; \ 131 #define FIFTYONE_DEGREES_EXCEPTION_CLEAR \ 132 exception->file = NULL; \ 133 exception->func = NULL; \ 134 exception->line = -1; \ 135 exception->status = FIFTYONE_DEGREES_STATUS_NOT_SET; 140 #define FIFTYONE_DEGREES_EXCEPTION_OKAY \ 141 (exception == NULL || exception->status == FIFTYONE_DEGREES_STATUS_NOT_SET) 143 #ifdef FIFTYONE_DEGREES_EXCEPTIONS_HPP 149 #define FIFTYONE_DEGREES_EXCEPTION_THROW \ 150 if (FIFTYONE_DEGREES_EXCEPTION_OKAY == false) { \ 151 throw FiftyoneDegrees::Common::FatalException(exception); \ 159 #define FIFTYONE_DEGREES_EXCEPTION_THROW \ 160 fiftyoneDegreesExceptionCheckAndExit(exception); 168 #define FIFTYONE_DEGREES_EXCEPTION_CLEAR exception = NULL; 170 #define FIFTYONE_DEGREES_EXCEPTION_SET(s) exception = NULL; 172 #define FIFTYONE_DEGREES_EXCEPTION_OKAY (exception == exception) 174 #define FIFTYONE_DEGREES_EXCEPTION_THROW 181 #define FIFTYONE_DEGREES_EXCEPTION_CREATE \ 182 fiftyoneDegreesException exceptionValue; \ 183 fiftyoneDegreesException *exception = &exceptionValue; \ 184 FIFTYONE_DEGREES_EXCEPTION_CLEAR 189 #define FIFTYONE_DEGREES_EXCEPTION_FAILED \ 190 (FIFTYONE_DEGREES_EXCEPTION_OKAY == false) const char * func
Function generating the exception.
Definition: exceptions.h:111
fiftyoneDegreesStatusCode status
Status code to assign.
Definition: exceptions.h:113
fiftyoneDegreesStatusCode
Status returned from the initialisation of a resource.
Definition: status.h:75
EXTERNAL void fiftyoneDegreesExceptionCheckAndExit(fiftyoneDegreesException *exception)
If the exception is set then will print a message to stderr and exit the process.
Definition: exceptionsc.c:53
int line
Line number generating the exception.
Definition: exceptions.h:112
const char * file
File generating the exception.
Definition: exceptions.h:110
EXTERNAL const char * fiftyoneDegreesExceptionGetMessage(fiftyoneDegreesException *exception)
Returns an English error message for the exception.
Definition: exceptionsc.c:21
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:109