Error Class Reference
This class to capture error information from library function calls. More...
Public Member Functions
|
operator bool () const noexcept Checks whether this object is in an error state. |
|
| bool | isError () const noexcept Checks whether this object is in an error state. |
| bool | isSuccess () const noexcept Checks whether this object is in a success state. |
| ErrorCode | code () const noexcept Returns the error code. |
| std::string |
message () const Returns the error message. |
Static Public Member Functions
| static Error & | Ignore () An error handler that ignores all errors. |
| static Error & | Throw () An error handler that throws all errors. |
| static Error & | Default () The default error handler. |
Detailed Description
This class to capture error information from library function calls.
See Error Handling for a general overview of how error handling works in this library.
Member Function Documentation
◆ code()
|
inlinenoexcept |
Returns the error code.
- Returns
- The error code of the operation that filled this error object.
◆ Default()
|
inlinestatic |
The default error handler.
The err parameter of all library functions is set to Default() by default.
If a function that got Default() passed as its err parameter, the behavior is as follows:
- If the library was initialized by passing ErrorHandlerBehavior::Throw to initLibrary, a IC4Exception is thrown.
- If the library was initialized with ErrorHandlerBehavior::Ignore, the error is ignored
- Returns
- An error handler following the default procedure described above.
- See also
- Error Handling
◆ Ignore()
|
inlinestatic |
An error handler that ignores all errors.
If an error occurs during a function call its argument set to Ignore(), errors are ignored.
The return value of the function can still signal a possible error condition.
- Returns
- An error handler that ignores all errors.
- See also
- Error Handling
◆ isError()
|
inlinenoexcept |
Checks whether this object is in an error state.
- Returns
true, if this error's code is not equal to ErrorCode::NoError, otherwisefalse.
- See also
- isSuccess
◆ isSuccess()
|
inlinenoexcept |
Checks whether this object is in a success state.
- Returns
true, if this error's code is equal to ErrorCode::NoError, otherwisefalse.
- See also
- isError
◆ message()
|
inline |
Returns the error message.
- Returns
- The error message generated by the failed operation that filled this error object.
If no error occurred, an empty string is returned.
◆ operator bool()
|
inlineexplicitnoexcept |
Checks whether this object is in an error state.
- Returns
true, if this error's code is not equal to ErrorCode::NoError, otherwisefalse.
- See also
- isError
- isSuccess
◆ Throw()
|
inlinestatic |
An error handler that throws all errors.
If an error occurs during a function call with its err argument set to Throw(), IC4Exception is thrown.
- Returns
- An error handler that throws all errors as a IC4Exception.
- See also
- Error Handling


