Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
ErrorHandling.h
1 /*===-- serialbox-c/ErrorHandling.h -------------------------------------------------*- C++ -*-===*\
2  *
3  * S E R I A L B O X
4  *
5  * This file is distributed under terms of BSD license.
6  * See LICENSE.txt for more information
7  *
8  *===------------------------------------------------------------------------------------------===//
9  *
10  *! \file
11  *! This file contains the error handling of the C Interface of Serialbox.
12  *
13 \*===------------------------------------------------------------------------------------------===*/
14 
15 #include "serialbox-c/Api.h"
16 
17 #ifndef SERIALBOX_C_ERRORHANDLING_H
18 #define SERIALBOX_C_ERRORHANDLING_H
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
39 SERIALBOX_API void serialboxFatalError(const char* reason);
40 
44 SERIALBOX_API typedef void (*serialboxFatalErrorHandler_t)(const char* reason);
45 
57 
63 SERIALBOX_API void serialboxResetFatalErrorHandler(void);
64 
65 /*===------------------------------------------------------------------------------------------===*\
66  * Default Error Handler
67 \*===------------------------------------------------------------------------------------------===*/
68 
72 void serialboxDefaultFatalErrorHandler(const char* reason);
73 
74 /*===------------------------------------------------------------------------------------------===*\
75  * State Error Handler
76 \*===------------------------------------------------------------------------------------------===*/
77 
82 SERIALBOX_API void serialboxStateErrorHandler(const char* reason);
83 
92 SERIALBOX_API int serialboxStateErrorHandlerHasError(void);
93 
101 SERIALBOX_API char* serialboxStateErrorHandlerGetErrorMessage(void);
102 
106 SERIALBOX_API void serialboxStateErrorHandlerResetState(void);
107 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif
SERIALBOX_API void serialboxResetFatalErrorHandler(void)
Reset the fatal error handler.
SERIALBOX_API int serialboxStateErrorHandlerHasError(void)
Check the current error state.
SERIALBOX_API char * serialboxStateErrorHandlerGetErrorMessage(void)
Query the current error state.
SERIALBOX_API void serialboxInstallFatalErrorHandler(serialboxFatalErrorHandler_t handler)
Install a fatal error handler.
SERIALBOX_API void serialboxStateErrorHandler(const char *reason)
Store the the current state of the error which can be queried via serialboxStateErrorHandlerGetLastEr...
SERIALBOX_API void serialboxStateErrorHandlerResetState(void)
Reset the current error state.
SERIALBOX_API void serialboxFatalError(const char *reason)
Report a fatal error.
void serialboxDefaultFatalErrorHandler(const char *reason)
Emit the last error string to stderr and call exit(1)
SERIALBOX_API typedef void(* serialboxFatalErrorHandler_t)(const char *reason)
Error handler callback.
Definition: ErrorHandling.h:44