EM-ODP
3.7.0
Event Machine on ODP
|
Error/Exception management. More...
Typedefs | |
typedef em_status_t(* | em_error_handler_t) (em_eo_t eo, em_status_t error, em_escope_t escope, va_list args) |
Functions | |
em_status_t | em_register_error_handler (em_error_handler_t handler) |
em_status_t | em_unregister_error_handler (void) |
void | em_error (em_status_t error, em_escope_t escope,...) |
Error/Exception management.
EM provides two basic mechanisms to manage operational exceptions
typedef em_status_t(* em_error_handler_t) (em_eo_t eo, em_status_t error, em_escope_t escope, va_list args) |
Error handler prototype
The error handler is called after EM notices an error or the user has called em_error().
The user can register EO specific and/or EM global error handlers. When an error occurs, EM calls the EO specific error handler, if registered. If there's no EO specific handler registered or the error occurs outside of an EO context, EM calls the global error handler.
The error handler is called with the original error code (that's about to be returned) from the API call or em_error(). The error scope identifies the source of the error and how the error code and the variable arguments should be interpreted (number of arguments and types) in an implementation specific way.
eo | Execution object id |
error | The error code |
escope | Error scope. Identifies the scope for interpreting the error code and variable arguments. |
args | Variable number and type of arguments |
Definition at line 94 of file event_machine_error.h.
void em_error | ( | em_status_t | error, |
em_escope_t | escope, | ||
... | |||
) |
Report an error.
Reported errors are handled by the appropriate (EO specific or global) error handler.
Depending on the error/scope/implementation, the function call may not return.
error | Error code |
escope | Error scope. Identifies the scope for interpreting the error code and the variable arguments. |
... | Variable number and type of arguments |
Definition at line 66 of file event_machine_error.c.
em_status_t em_register_error_handler | ( | em_error_handler_t | handler | ) |
Register a global error handler.
The global error handler is called on EM errors or by em_error() calls, except when running in an EO context with an EO specific error handler registered (in which case the EO specific error handler takes precedence). Note, the provided function will override any previously registered global error handler. The EM default global error handler is used when no user provided global error handler is registered.
handler | Error handler. |
Definition at line 34 of file event_machine_error.c.
em_status_t em_unregister_error_handler | ( | void | ) |
Unregister a global error handler.
Unregisters any previously registered global error handler and restores the EM default global error handler into use.
Definition at line 50 of file event_machine_error.c.