43 #ifndef LUMIERA_ERROR_H 44 #define LUMIERA_ERROR_H 57 typedef const char* lumiera_err;
63 #define LUMIERA_DIE(err) \ 64 do { NOBUG_ERROR(NOBUG_ON, "Fatal Error: %s ", strchr(LUMIERA_ERROR_##err, ':')); abort(); } while(0) 71 #define LUMIERA_ERROR_DECLARE(err) \ 72 extern lumiera_err const LUMIERA_ERROR_##err 80 #define LUMIERA_ERROR_DEFINE(err, msg) \ 81 lumiera_err const LUMIERA_ERROR_##err = "LUMIERA_ERROR_" #err ":" msg 91 #define LUMIERA_ERROR_SET(flag, err, extra) \ 93 const char* theextra = extra; \ 94 ERROR (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \ 95 lumiera_error_set(LUMIERA_ERROR_##err, theextra); \ 106 #define LUMIERA_ERROR_SET_ALERT(flag, err, extra) \ 108 const char* theextra = extra; \ 109 ALERT (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \ 110 lumiera_error_set(LUMIERA_ERROR_##err, theextra); \ 121 #define LUMIERA_ERROR_SET_CRITICAL(flag, err, extra) \ 123 const char* theextra = extra; \ 124 CRITICAL (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:"");\ 125 lumiera_error_set(LUMIERA_ERROR_##err, theextra); \ 136 #define LUMIERA_ERROR_SET_WARNING(flag, err, extra) \ 138 const char* theextra = extra; \ 139 WARN (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \ 140 lumiera_error_set(LUMIERA_ERROR_##err, theextra); \ lumiera_err lumiera_error_set(lumiera_err nerr, const char *extra)
Set error state for the current thread.
const char * lumiera_error_extra(void)
Query the extra context for the last error.
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
int lumiera_error_expect(lumiera_err expected)
Expect some error Check that the current error state matches some expectation, if true then the error...
lumiera_err lumiera_error(void)
Get and clear current error state.
lumiera_err lumiera_error_peek(void)
Check current error state without clearing it Please avoid this function and use lumiera_error() if p...