This module provides error handling functionality that can be used throughout the CABLE codebase.
Error handling behaviour is controlled internally by either the global error
handler instance (error_handler_global) or the fallback error handler
instance (error_handler_fallback). The global error handler instance can be
set via cable_error_handler_set to provide custom error handling behaviour,
while the fallback error handler instance provides a default implementation of
the error handling behaviour. The global error handler is polymorphic which
allows for customising the error handling behaviour dynamically at runtime. To
do this we can create a new type that extends cable_error_handler_base_t with
the new error handling behaviour and set the global error handler to an
instance of the extended type.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(cable_error_handler_base_t), | private, | target | :: | error_handler_fallback | = | cable_error_handler_base_t() | |
| class(cable_error_handler_base_t), | private, | allocatable, target | :: | error_handler_global |
Set the global error handler instance.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cable_error_handler_base_t), | intent(in) | :: | new_error_handler |
New error handler instance to set as the global error handler. |
Free the global error handler instance.
Abort CABLE with an error message.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | message |
Error message to display |
||
| character(len=*), | intent(in) | :: | file |
Source file where the error occurred |
||
| integer, | intent(in) | :: | line |
Line number where the error occurred |
||
| integer, | intent(in), | optional | :: | error_code |
Optional error code |