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 \ 135 exception->file = NULL; \ 136 exception->func = NULL; \ 137 exception->line = -1; \ 138 exception->status = FIFTYONE_DEGREES_STATUS_NOT_SET; \ 147 #define FIFTYONE_DEGREES_EXCEPTION_CHECK(t) \ 148 (exception == NULL || exception->status == t) 153 #define FIFTYONE_DEGREES_EXCEPTION_OKAY \ 154 FIFTYONE_DEGREES_EXCEPTION_CHECK(FIFTYONE_DEGREES_STATUS_NOT_SET) 156 #ifdef FIFTYONE_DEGREES_EXCEPTIONS_HPP 162 #define FIFTYONE_DEGREES_EXCEPTION_THROW \ 163 if (FIFTYONE_DEGREES_EXCEPTION_OKAY == false) { \ 164 throw FiftyoneDegrees::Common::FatalException(exception); \ 172 #define FIFTYONE_DEGREES_EXCEPTION_THROW \ 173 fiftyoneDegreesExceptionCheckAndExit(exception); 181 #define FIFTYONE_DEGREES_EXCEPTION_CLEAR 183 #define FIFTYONE_DEGREES_EXCEPTION_SET(s) 185 #define FIFTYONE_DEGREES_EXCEPTION_OKAY true 187 #define FIFTYONE_DEGREES_EXCEPTION_THROW 189 #define FIFTYONE_DEGREES_EXCEPTION_CHECK(t) false 196 #define FIFTYONE_DEGREES_EXCEPTION_CREATE \ 197 fiftyoneDegreesException exceptionValue; \ 198 fiftyoneDegreesException *exception = &exceptionValue; \ 199 FIFTYONE_DEGREES_EXCEPTION_CLEAR 204 #define FIFTYONE_DEGREES_EXCEPTION_FAILED \ 205 (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