errors Derived Type

type, public :: errors

@brief Defines a type for managing errors and warnings.


Contents


Type-Bound Procedures

procedure, public :: get_clean_up_routine => er_get_err_fcn_ptr

  • private subroutine er_get_err_fcn_ptr(this, ptr)

    Gets the subroutine to call when an error has been logged.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    procedure(error_callback), intent(out), pointer :: ptr

    A pointer to the error_callback routine.

procedure, public :: get_error_fcn_name => er_get_err_fcn

  • private function er_get_err_fcn(this) result(fcn)

    Gets the name of the routine that initiated the error.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value character(len=:), allocatable

    The subroutine or function name.

procedure, public :: get_error_flag => er_get_error_flag

  • private pure function er_get_error_flag(this) result(x)

    Gets the current error flag.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value integer(kind=int32)

    The current error flag.

procedure, public :: get_error_message => er_get_err_msg

  • private function er_get_err_msg(this) result(msg)

    Gets the current error message.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value character(len=:), allocatable

    The error message.

procedure, public :: get_exit_on_error => er_get_exit_on_error

  • private pure function er_get_exit_on_error(this) result(x)

    Gets a logical value determining if the application should be terminated when an error is encountered.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value logical

    Returns true if the application should be terminated; else, false.

procedure, public :: get_log_filename => er_get_log_filename

  • private pure function er_get_log_filename(this) result(str)

    Gets the name of the error log file.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value character(len=:), allocatable

    The filename.

procedure, public :: get_suppress_printing => er_get_suppress_printing

  • private pure function er_get_suppress_printing(this) result(x)

    Gets a logical value determining if printing of error and warning messages should be suppressed.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value logical

    True if message printing should be suppressed; else, false to allow printing.

procedure, public :: get_warning_fcn_name => er_get_warning_fcn

  • private function er_get_warning_fcn(this) result(fcn)

    Gets the name of the routine that initiated the warning.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value character(len=:), allocatable

    The subroutine or function name.

procedure, public :: get_warning_flag => er_get_warning_flag

  • private pure function er_get_warning_flag(this) result(x)

    Gets the current warning flag.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value integer(kind=int32)

    The current warning flag.

procedure, public :: get_warning_message => er_get_warning_msg

  • private function er_get_warning_msg(this) result(msg)

    Gets the current warning message.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value character(len=:), allocatable

    The warning message.

procedure, public :: has_error_occurred => er_has_error_occurred

  • private pure function er_has_error_occurred(this) result(x)

    Tests to see if an error has been encountered.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value logical

    Returns true if an error has been encountered; else, false.

procedure, public :: has_warning_occurred => er_has_warning_occurred

  • private pure function er_has_warning_occurred(this) result(x)

    Tests to see if a warning has been encountered.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

    Return Value logical

    Returns true if a warning has been encountered; else, false.

procedure, public :: log_error => er_log_error

  • private subroutine er_log_error(this, fcn, msg, flag)

    Writes an error log file.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(in) :: this

    The errors object.

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

    The name of the function or subroutine in which the error was encountered.

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

    The error message.

    integer(kind=int32), intent(in) :: flag

    The error flag.

procedure, public :: report_error => er_report_error

  • private subroutine er_report_error(this, fcn, msg, flag, obj)

    Reports an error condition to the user. The default behavior prints an error message, appends the supplied information to a log file, and terminates the program.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

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

    The name of the function or subroutine in which the error was encountered.

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

    The error message.

    integer(kind=int32), intent(in) :: flag

    The error flag.

    class(*), intent(inout), optional :: obj

    An optional unlimited polymorphic object that can be passed to provide information to the clean-up routine.

procedure, public :: report_warning => er_report_warning

  • private subroutine er_report_warning(this, fcn, msg, flag)

    Reports a warning message to the user. The default behavior prints the warning message, and returns control back to the calling code.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

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

    The name of the function or subroutine from which the warning was issued.

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

    The warning message.

    integer(kind=int32), intent(in) :: flag

    The warning flag.

procedure, public :: reset_error_status => er_reset_error_status

  • private subroutine er_reset_error_status(this)

    Resets the error status flag to false, and the current error flag to zero.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

procedure, public :: reset_warning_status => er_reset_warning_status

  • private subroutine er_reset_warning_status(this)

    Resets the warning status flag to false, and the current warning flag to zero.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

procedure, public :: set_clean_up_routine => er_set_err_fcn_ptr

  • private subroutine er_set_err_fcn_ptr(this, ptr)

    Sets the subroutine to call when an error has been logged.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

    procedure(error_callback), intent(in), pointer :: ptr

    A pointer to the error_callback routine.

procedure, public :: set_exit_on_error => er_set_exit_on_error

  • private subroutine er_set_exit_on_error(this, x)

    Sets a logical value determining if the application should be terminated when an error is encountered.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

    logical, intent(in) :: x

    Set to true if the application should be terminated when an error is reported; else, false.

procedure, public :: set_log_filename => er_set_log_filename

  • private subroutine er_set_log_filename(this, str)

    Sets the name of the error log file.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

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

    The filename.

procedure, public :: set_suppress_printing => er_set_suppress_printing

  • private subroutine er_set_suppress_printing(this, x)

    Sets a logical value determining if printing of error and warning messages should be suppressed.

    Arguments

    Type IntentOptional Attributes Name
    class(errors), intent(inout) :: this

    The errors object.

    logical, intent(in) :: x

    Set to true if message printing should be suppressed; else, false to allow printing.