diff options
Diffstat (limited to 'libdimension/dimension/error.h')
-rw-r--r-- | libdimension/dimension/error.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libdimension/dimension/error.h b/libdimension/dimension/error.h index 3204cb2..cd7dd81 100644 --- a/libdimension/dimension/error.h +++ b/libdimension/dimension/error.h @@ -18,23 +18,26 @@ * <http://www.gnu.org/licenses/>. * *************************************************************************/ -#ifndef DIMENSION_ERROR_H -#define DIMENSION_ERROR_H - /* - * Error handling. + * Error handling. Errors are reported at a given severity by the dmnsn_error() + * macro at a given severity, which prints a warning if it is below the set + * resilience, or prints an error and exits if it's at or above the set + * resilience. */ +#ifndef DIMENSION_ERROR_H +#define DIMENSION_ERROR_H + typedef enum { DMNSN_SEVERITY_LOW, /* Only die on low resilience */ DMNSN_SEVERITY_MEDIUM, /* Die on low or medium resilience */ DMNSN_SEVERITY_HIGH /* Always die */ } dmnsn_severity; -/* Use this to report an error */ -#define dmnsn_error(severity, str) \ - dmnsn_report_error((dmnsn_severity)severity, __PRETTY_FUNCTION__, __LINE__, \ - str) +/* Use this macro to report an error */ +#define dmnsn_error(severity, str) \ + dmnsn_report_error((dmnsn_severity)(severity), __PRETTY_FUNCTION__, __LINE__,\ + (str)) /* Called by dmnsn_error() - don't call directly */ void dmnsn_report_error(dmnsn_severity severity, |