mimic_errors Module



Contents


Variables

TypeVisibilityAttributesNameInitial
character(len=*), private, parameter:: ERROR_FILE ="('MiMiC_error-',i0,'.err')"

Format for the error file name

integer, public, parameter:: SEVERITY_WARN =1

Severity level of the error Warning is a recoverable condition with a fallback available

integer, public, parameter:: SEVERITY_FATAL =2

Severity for unrecoverable condition in which, no fallback can be found

integer, public, parameter:: TYPE_MEM =1

Error type associated with the memory allocation

integer, public, parameter:: TYPE_INCORRECT_ARG =2

Error type associated with the incorrect argument passed

integer, public, parameter:: TYPE_NONE =-1

Generic error type

integer, private, save:: process_id =-1
procedure(handle), private, pointer, save:: custom_handler=> NULL()

Interfaces

interface

  • public subroutine handle(err_type, message, source_file, line_num)

    Arguments

    TypeIntentOptionalAttributesName
    integer, intent(in) :: err_type

    Type of the error

    character(len=*), intent(in) :: message

    Optional message

    character(len=*), intent(in) :: source_file

    Source file where the problem occurred

    integer, intent(in) :: line_num

    Source line at which the error occurred


Subroutines

public subroutine init_error_handling(pid, error_handler)

initialiaze error handler

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: pid

process ID (preferrably MPI rank)

procedure(handle), optional pointer:: error_handler

optional external error handler

private subroutine print_warning(iounit, source_file, line_num)

Subroutine to print warning header

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: iounit

I/O unit to write warning to

character(len=*), intent(in) :: source_file

Source file where the warning was issued

integer, intent(in) :: line_num

Line number at which the warning was issued

private subroutine write_error_header(iounit, source_file, line_num)

Subroutine to print error header

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: iounit

I/O unit to write error to

character(len=*), intent(in) :: source_file

Source file where the error was issued

integer, intent(in) :: line_num

Line number at which the error was issued

private subroutine handle_mem_error(iounit, message)

Handler to treat memory allocation issues

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: iounit

I/O unit to write error to

character(len=*), intent(in) :: message

Error message

private subroutine handle_inc_error(iounit, message)

Handler to treat incorrect argument errors

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: iounit

I/O unit to write error to

character(len=*), intent(in) :: message

Error message

private subroutine handle_generic_error(iounit, message)

Handler to treat any other kind of errors

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: iounit

I/O unit to write error to

character(len=*), intent(in) :: message

Error message

public subroutine handle_error(severity, err_type, message, source_file, line_num)

Subroutine to handle errors

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: severity

Severity level of the error

integer, intent(in) :: err_type

Type of the error

character(len=*), intent(in) :: message

Optional message

character(len=*), intent(in) :: source_file

Source file where the problem occurred

integer, intent(in) :: line_num

Source line at which the error occurred