![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
implementation of C-style error handling in Lumiera. More...
Go to the source code of this file.
implementation of C-style error handling in Lumiera.
This implementation is based on a thread local error flag. C++ code uses a custom exception hierarchy, which automatically sets the error flag whenever an exception is thrown.
Definition in file error-state.c.
Typedefs | |
| typedef lumiera_errorcontext * | LumieraErrorcontext |
Classes | |
| struct | lumiera_errorcontext |
| Holding error and some context data. More... | |
Functions | |
| LUMIERA_ERROR_DEFINE (ERRNO, "errno") | |
| LUMIERA_ERROR_DEFINE (EERROR, "could not initialise error system") | |
| LUMIERA_ERROR_DEFINE (UNKNOWN, "unknown error") | |
| static void | lumiera_error_tls_delete (void *err) |
| static void | lumiera_error_tls_init (void) |
| LumieraErrorcontext | lumiera_error_get (void) |
| lumiera_err | lumiera_error_set (lumiera_err nerr, const char *extra) |
| Set error state for the current thread. | |
| lumiera_err | lumiera_error (void) |
| Get and clear current error state. | |
| const char * | lumiera_error_extra (void) |
| Query the extra context for the last error. | |
| lumiera_err | lumiera_error_peek (void) |
| Check current error state without clearing it Please avoid this function and use lumiera_error() if possible. | |
| int | lumiera_error_expect (lumiera_err expected) |
| Expect some error Check that the current error state matches some expectation, if true then the error state is cleared and 1 is returned, otherwise 0 is returned and the error state remains set. | |
Variables | |
| static pthread_key_t | lumiera_error_tls |
| static pthread_once_t | lumiera_error_initialized = PTHREAD_ONCE_INIT |
| typedef lumiera_errorcontext* LumieraErrorcontext |
Definition at line 54 of file error-state.c.
| struct lumiera_errorcontext_struct |
| LUMIERA_ERROR_DEFINE | ( | ERRNO | , |
| "errno" | |||
| ) |
| LUMIERA_ERROR_DEFINE | ( | EERROR | , |
| "could not initialise error system" | |||
| ) |
| LUMIERA_ERROR_DEFINE | ( | UNKNOWN | , |
| "unknown error" | |||
| ) |
|
static |
Definition at line 58 of file error-state.c.
References extra.
Referenced by lumiera_error_tls_init().
Here is the caller graph for this function:
|
static |
Definition at line 66 of file error-state.c.
References LUMIERA_DIE, lumiera_error_tls, and lumiera_error_tls_delete().
Referenced by lumiera_error_get().
Here is the call graph for this function:
Here is the caller graph for this function:| LumieraErrorcontext lumiera_error_get | ( | void | ) |
Definition at line 74 of file error-state.c.
References LUMIERA_DIE, lumiera_error_initialized, lumiera_error_tls, lumiera_error_tls_init(), and NULL.
Referenced by lumiera_error(), lumiera_error_expect(), lumiera_error_extra(), lumiera_error_peek(), lumiera_error_set(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| lumiera_err lumiera_error_set | ( | lumiera_err | nerr, |
| const char * | extra | ||
| ) |
Set error state for the current thread.
If the error state of the current thread was cleared, then set it, else preserve the old state.
| nerr | name of the error with 'LUMIERA_ERROR_' prefix (example: LUMIERA_ERROR_NO_MEMORY) |
| extra | a string (possibly a constructed tmpbuf) which adds some more context to the error, can be a temporary |
Definition at line 96 of file error-state.c.
References extra, lumiera_error_get(), and NULL.
Referenced by ExceptionError_test::checkErrorFlagPropagation(), stage::anonymous_namespace{notification-service.cpp}::LUMIERA_INTERFACE_INSTANCE(), steam::control::anonymous_namespace{session-command-service.cpp}::LUMIERA_INTERFACE_INSTANCE(), lumiera_lockerror_set(), main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| lumiera_err lumiera_error | ( | void | ) |
Get and clear current error state.
This function clears the error state, if it needs to be reused, one has to store it in a temporary variable.
Definition at line 115 of file error-state.c.
References lumiera_errorcontext::err, lumiera_error_get(), and NULL.
Referenced by ExecResult::ExecResult(), GuiRunner::GuiRunner(), MockElm::~MockElm(), util::anonymous_namespace{format-string.hpp}::_clear_errorflag(), util::anonymous_namespace{format-string.hpp}::_log_unknown_exception(), OutputDirector::bringDown(), AdviceSystem::deregisterRequest(), Suite::describe(), TypedAllocationManager::destroyElement(), stage::ctrl::anonymous_namespace{ui-dispatcher.hpp}::generateErrorResponse(), HandlingPattern::invoke(), test::anonymous_namespace{suite.cpp}::invokeTestCase(), Index< POA >::isValid(), PlacementIndex::isValid(), stage::launchUI(), lumiera::anonymous_namespace{appstate.cpp}::log_and_clear_unexpected_errorstate(), lumiera_plugin_init(), lumiera::error::lumiera_unexpectedException(), main(), main(), lumiera::maybeThrow(), AllocatorHandle< TY >::operator()(), GtkLumiera::run(), MockSys::run(), DispatcherLoop::runSessionThread(), Provision< AD >::storeCopy(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), lumiera::anonymous_namespace{instancehandle.hpp}::throwIfError(), and lumiera::throwOnError().
Here is the call graph for this function:
Here is the caller graph for this function:| const char * lumiera_error_extra | ( | void | ) |
Query the extra context for the last error.
Definition at line 126 of file error-state.c.
References lumiera_error_get().
Referenced by lumiera::error::detailInfo().
Here is the call graph for this function:
Here is the caller graph for this function:| lumiera_err lumiera_error_peek | ( | void | ) |
Check current error state without clearing it Please avoid this function and use lumiera_error() if possible.
Errors must be cleared else certain parts of the application refuse to cooperate with you. This shall only be used to decide if one wants to barf out of a loop or subroutine to deliver the error to a higher level.
Definition at line 133 of file error-state.c.
References lumiera_error_get().
Referenced by GuiRunner::GuiRunner(), GuiSubsysDescriptor::~GuiSubsysDescriptor(), CommandUse2_test::check_defaultHandlingPattern(), ExceptionError_test::checkErrorFlagPropagation(), lumiera_plugin_discover(), lumiera_plugin_register(), GtkLumiera::run(), and lumiera::anonymous_namespace{instancehandle.hpp}::throwIfError().
Here is the call graph for this function:
Here is the caller graph for this function:| int lumiera_error_expect | ( | lumiera_err | expected | ) |
Expect some error Check that the current error state matches some expectation, if true then the error state is cleared and 1 is returned, otherwise 0 is returned and the error state remains set.
| expected | error which is expected |
Definition at line 139 of file error-state.c.
References lumiera_error_get(), and NULL.
Here is the call graph for this function:
|
static |
Definition at line 41 of file error-state.c.
Referenced by lumiera_error_get(), and lumiera_error_tls_init().
|
static |
Definition at line 42 of file error-state.c.
Referenced by lumiera_error_get().