Type that can be used to handle errors for multiple code instances at once. Each calling code may create a singleton instance of this type. There is no initialize routine, the instance should be initialized via the constructor.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=32), | public | :: | handler_name |
Name of the error handler instance |
|||
| integer, | public | :: | error_mode |
Error mode chosen, can be either ERRORS_RETURN or ERRORS_ARE_FATAL |
|||
| integer, | public | :: | netcdf_error_code |
Error code that is associated with NetCDF errors. Used when handling NetCDF errors. |
|||
| logical, | public | :: | first_time_warning | = | .true. |
Indicates that a warning has already been printed before or not |
Set the error mode of the type instance
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(error_handler_t), | intent(inout) | :: | this |
Instance of the type |
||
| integer, | intent(in) | :: | err_mode |
Error mode: Use ERRORS_RETURN or ERRORS_ARE_FATAL. Other values are ignored and ERRORS_ARE_FATAL is used |
Handle the given error by printing out messages and terminating the program if status_code is an error code.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(error_handler_t), | intent(inout) | :: | this |
Instance of the type |
||
| character(len=*), | intent(in) | :: | message |
Error or warning message |
||
| integer, | intent(in) | :: | status_code |
Error or warning code |
||
| integer, | intent(in) | :: | line_number |
Line number where error or warning occured, i.e. LINE |
||
| character(len=*), | intent(in) | :: | file_name |
File name where error or warning occured, i.e. FILE |
||
| type(error_info_t), | intent(in), | optional | :: | additional_info |
Additional information |
Handle the given NetCDF error by calling handle_error with special preprocessing taylored to NetCDF errors.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(error_handler_t), | intent(inout) | :: | this |
Instance of the type |
||
| integer, | intent(in) | :: | istatus |
Status integer returned by the NetCDF function |
||
| integer, | intent(in) | :: | line_number |
Line number where error or warning occured, i.e. LINE |
||
| character(len=*), | intent(in) | :: | file_name |
File name where error or warning occured, i.e. FILE |