23#ifndef FIFTYONE_DEGREES_EXCEPTIONS_H_INCLUDED
24#define FIFTYONE_DEGREES_EXCEPTIONS_H_INCLUDED
26#ifdef FIFTYONE_DEGREES_IPI_SYMBOLS
27#include "ipiSymbols.h"
106#ifndef FIFTYONE_DEGREES_EXCEPTIONS_DISABLED
115EXTERNAL
typedef struct fiftyone_degrees_exception_t {
126#define FIFTYONE_DEGREES_EXCEPTION_SET(s) \
127if (exception != NULL) { \
128exception->file = __FILE__; \
129exception->func = __func__; \
130exception->line = __LINE__; \
131exception->status = s; \
137#define FIFTYONE_DEGREES_EXCEPTION_CLEAR \
139exception->file = NULL; \
140exception->func = NULL; \
141exception->line = -1; \
142exception->status = FIFTYONE_DEGREES_STATUS_NOT_SET; \
151#define FIFTYONE_DEGREES_EXCEPTION_CHECK(t) \
152(exception == NULL || exception->status == t)
157#define FIFTYONE_DEGREES_EXCEPTION_OKAY \
158FIFTYONE_DEGREES_EXCEPTION_CHECK(FIFTYONE_DEGREES_STATUS_NOT_SET)
160#ifdef FIFTYONE_DEGREES_EXCEPTIONS_HPP
166#define FIFTYONE_DEGREES_EXCEPTION_THROW \
167if (FIFTYONE_DEGREES_EXCEPTION_OKAY == false) { \
168throw FiftyoneDegrees::Common::FatalException(exception); \
176#define FIFTYONE_DEGREES_EXCEPTION_THROW \
177fiftyoneDegreesExceptionCheckAndExit(exception);
185#define FIFTYONE_DEGREES_EXCEPTION_CLEAR
187#define FIFTYONE_DEGREES_EXCEPTION_SET(s)
189#define FIFTYONE_DEGREES_EXCEPTION_OKAY true
191#define FIFTYONE_DEGREES_EXCEPTION_THROW
193#define FIFTYONE_DEGREES_EXCEPTION_CHECK(t) false
200#define FIFTYONE_DEGREES_EXCEPTION_CREATE \
201fiftyoneDegreesException exceptionValue; \
202fiftyoneDegreesException *exception = &exceptionValue; \
203FIFTYONE_DEGREES_EXCEPTION_CLEAR
208#define FIFTYONE_DEGREES_EXCEPTION_FAILED \
209(FIFTYONE_DEGREES_EXCEPTION_OKAY == false)
void fiftyoneDegreesExceptionCheckAndExit(fiftyoneDegreesException *exception)
If the exception is set then will print a message to stderr and exit the process.
const char * fiftyoneDegreesExceptionGetMessage(fiftyoneDegreesException *exception)
Returns an English error message for the exception.
fiftyoneDegreesStatusCode
Status returned from the initialisation of a resource.
Definition status.h:81
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition exceptions.h:115
const char * file
File generating the exception.
Definition exceptions.h:116
const char * func
Function generating the exception.
Definition exceptions.h:117
int line
Line number generating the exception.
Definition exceptions.h:118
fiftyoneDegreesStatusCode status
Status code to assign.
Definition exceptions.h:119