Macros to simplify conditional error handling.
◆ TRY_EXEC
| #define TRY_EXEC |
( |
| pred, |
|
|
| block ) |
Value: do { \
if (!(pred)) { \
do \
block while (0); \
} \
} while (0)
◆ TRY_GOTO
| #define TRY_GOTO |
( |
| pred, |
|
|
| label ) |
Value: do { \
if (!(pred)) { \
goto label; \
} \
} while (0)
◆ TRY_LOG
| #define TRY_LOG |
( |
| pred, |
|
|
| msg ) |
Value: do { \
if (!(pred)) { \
fprintf(stderr,
"Error catched at %s:%s[%d]: %s",
__FILENAME__, \
__func__, __LINE__, msg); \
} \
} while (0)
#define __FILENAME__
Macro to adjust the file path based on SOURCE_PATH_SIZE.
Definition logger.h:110
◆ TRY_THROW
| #define TRY_THROW |
( |
| pred | ) |
|
Value: do { \
if (!(pred)) { \
exit(EXIT_FAILURE); \
} \
} while (0)