KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
err.h File Reference

Manages the global system error. More...

#include <stdbool.h>
#include <stdint.h>
#include "util/macro.h"

Go to the source code of this file.

Functions

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...
 

Variables

const char * _errName
 

Detailed Description

Manages the global system error.

Definition in file err.h.

Function Documentation

static bool errCondRebase ( bool  err,
const char *  name 
)
inlinestatic

Transparent conditional error rebase.

Parameters
errThe result of the error function
nameThe name of the new error base
Returns
Same as err

Definition at line 117 of file err.h.

void errFatal ( )

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
clearWhen 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
nameNew 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
codeThe error code
errorThe error description
nameThe module where the error was generated
Returns
Always false. For compact code: return errSet(...)