![]() |
ErrorLib 1.0.8-master SHA: 810228da25
|
An error can be set everywhere in the code. This error with the error-text and additional metadata can be defined directly in the function which sets the error, or it can be defined elswhere before as globar error. If the error should not be define before the SetError function is used to raise the error.
Here an Example of a simple SetError call is shown:
In this example the error with the predefined identifier SampleErrorID_1 is raised. The identifier should be unique in project, but it is not neccessary for the error-system to work. Due to this the uniqueness is not checked anywhere. It is a good practice to define all error-identifier in a central file Error_ID_Device.h.
This error is resettable from users of the group user, professional and developer. This field is an or-concatenated list of the flags defined in the enum ERROR_FLAGS.
The error reaction which is called after raising this error is TestErrorReaction, which must be defined elswhere (see Page Actions on Error set and reset for details). On error reset no action is performed.
Text and description are displayed in the error-log. The helptext is shown on pc after pressing F1. It can contain several lines in german and english. See page Help-texts in Errors for details.
The german helpwindow:
English version:
In this example the headerfile must be included and the identifier defined (normally done in Error_ID_Device.h):
If the error is raised from several codelines, the error can be defined on a central place in code. The definition is shown in the following example:
The fileds of the definition are the same than the direct call.
This error can be raised by this simple line:
If the call should be done in a different file than the declaration, it must be visible in the calling file. This can be done with a declaration in the header file: