Manages the global system error.
More...
#include <stdbool.h>
#include <stdint.h>
#include "util/macro.h"
Go to the source code of this file.
|
bool | errSet (uint32_t code, const char *error, const char *name) |
| Sets an error. More...
|
|
void | errClear () |
| Clears the current error.
|
|
bool | errHas () |
| Returns whether there is an error pending.
|
|
const char * | errGetDescr () |
| Returns the last error description, if any, else null.
|
|
const char * | errGetName () |
| Returns the last error cause name, or null.
|
|
uint32_t | errGet () |
| Returns the last error code, or null.
|
|
void | errPrint (bool clear) |
| Prints the last error. More...
|
|
void | errFatal () |
| Prints the last error and halts the system. More...
|
|
static bool | errRebase (const char *name) |
| Rebases the cause of the error message. More...
|
|
static bool | errCondRebase (bool err, const char *name) |
| Transparent conditional error rebase. More...
|
|
Manages the global system error.
Definition in file err.h.
static bool errCondRebase |
( |
bool |
err, |
|
|
const char * |
name |
|
) |
| |
|
inlinestatic |
Transparent conditional error rebase.
- Parameters
-
err | The result of the error function |
name | The name of the new error base |
- Returns
- Same as err
Definition at line 117 of file err.h.
Prints the last error and halts the system.
If there is no error, the system will still be halted with an unknown error.
Definition at line 97 of file err.c.
void errPrint |
( |
bool |
clear | ) |
|
Prints the last error.
- Parameters
-
clear | When true, clears the error state. |
Definition at line 79 of file err.c.
static bool errRebase |
( |
const char * |
name | ) |
|
|
inlinestatic |
Rebases the cause of the error message.
- Parameters
-
name | New module reporting the error |
- Returns
- Always returns false
Definition at line 104 of file err.h.
bool errSet |
( |
uint32_t |
code, |
|
|
const char * |
error, |
|
|
const char * |
name |
|
) |
| |
Sets an error.
- Parameters
-
code | The error code |
error | The error description |
name | The module where the error was generated |
- Returns
- Always false. For compact code:
return errSet(...)