34 #ifndef LUMIERA_ERROR_H 35 #define LUMIERA_ERROR_H 48 typedef const char* lumiera_err;
54 #define LUMIERA_DIE(err) \ 55 do { NOBUG_ERROR(NOBUG_ON, "Fatal Error: %s ", strchr(LUMIERA_ERROR_##err, ':')); abort(); } while(0) 62 #define LUMIERA_ERROR_DECLARE(err) \ 63 extern lumiera_err const LUMIERA_ERROR_##err 71 #define LUMIERA_ERROR_DEFINE(err, msg) \ 72 lumiera_err const LUMIERA_ERROR_##err = "LUMIERA_ERROR_" #err ":" msg 82 #define LUMIERA_ERROR_SET(flag, err, extra) \ 84 const char* theextra = extra; \ 85 ERROR (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \ 86 lumiera_error_set(LUMIERA_ERROR_##err, theextra); \ 97 #define LUMIERA_ERROR_SET_ALERT(flag, err, extra) \ 99 const char* theextra = extra; \ 100 ALERT (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \ 101 lumiera_error_set(LUMIERA_ERROR_##err, theextra); \ 112 #define LUMIERA_ERROR_SET_CRITICAL(flag, err, extra) \ 114 const char* theextra = extra; \ 115 CRITICAL (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:"");\ 116 lumiera_error_set(LUMIERA_ERROR_##err, theextra); \ 127 #define LUMIERA_ERROR_SET_WARNING(flag, err, extra) \ 129 const char* theextra = extra; \ 130 WARN (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \ 131 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...