ErrorModule Module

A module to do handle error passing.



Contents


Derived Types

type, public ::  Error_t

A type that can be passed around to accumulate errors.


Functions

public function CheckMPIError(this, error_description, mpi_error, immediate_cleanup_in) result(error_occurred)

Routine to call to check if an MPI error has occurred.

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(inout) :: this

The error variable to be set.

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

Some string describing the details of the error.

integer, intent(in) :: mpi_error

The error variable produced by mpi.

logical, intent(in), optional :: immediate_cleanup_in

If true, the cleanup error handler is called.

Return Value logical

True if an error has occurred, false otherwise.

public function CheckAllocError(this, error_description, alloc_error, immediate_cleanup_in) result(error_occurred)

Routine to call if an alloc error has occurred.

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(inout) :: this

This the error variable to be set.

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

Some string describing the details of the error.

integer, intent(in) :: alloc_error

The error variable produced by alloc.

logical, intent(in), optional :: immediate_cleanup_in

If true, the cleanup error handler is called.

Return Value logical

True if an error has occurred, false otherwise.

public function ErrorOccurred(this) result(occurred)

Check if an error has occurred or not.

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(in) :: this

The error variable to check.

Return Value logical

True if an error has occurred, false otherwise.


Subroutines

public subroutine ConstructError(this)

Default constructor for an error type.

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(inout) :: this

The newly constructed error type

public subroutine SetGenericError(this, error_description, immediate_cleanup_in)

Routine to call if a generic error has occurred.

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(inout) :: this

The error variable to be set.

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

Some string describing the details of the error.

logical, intent(in), optional :: immediate_cleanup_in

If true, the cleanup error handler is called.

public subroutine SetCustomError(this, error_code, error_description, immediate_cleanup_in)

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(inout) :: this
integer, intent(in) :: error_code
character(len=*), intent(in) :: error_description
logical, intent(in), optional :: immediate_cleanup_in

public subroutine PrintError(this)

Print out that an error has occurred.

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(in) :: this

The error to print out.

public subroutine Cleanup(this)

As a last case resort, this will print an error message and quit.

Arguments

Type IntentOptional Attributes Name
type(Error_t), intent(in) :: this

The error which has caused the need to cleanup the program.