Module comb_error_mod

module comb_error_mod

        ! Uses
    use s2_types_mod, only: S2_STRING_LEN

        ! Variables
    integer, private, parameter :: COMB_ERROR_NUM = 9
    integer, public, parameter :: COMB_ERROR_NONE = 0
    integer, public, parameter :: COMB_ERROR_INIT = 1
    integer, public, parameter :: COMB_ERROR_NOT_INIT = 2
    integer, public, parameter :: COMB_ERROR_INIT_FAIL = 3
    integer, public, parameter :: COMB_ERROR_OBJ_MOTHER_INVALID = 4
    integer, public, parameter :: COMB_ERROR_CSKY_LMAX_NOT_DEF = 5
    integer, public, parameter :: COMB_ERROR_CSIM_NARG = 6
    integer, public, parameter :: COMB_ERROR_CSIM_PARAM_INVALID = 7
    integer, public, parameter :: COMB_ERROR_TMPL_PARAM_INVALID = 8
    character (len=S2_STRING_LEN), private, parameter, dimension (COMB_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Invalid comb mother obj to generate new obj from                         ', 'Lmax not defined when required                                           ', 'Invalid number of input parameters                                       ', 'Invalid input parameter                                                  ', 'Invalid number of input parameters in template function                  ' /)
    logical, private, parameter, dimension (COMB_ERROR_NUM) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .true., .true. /)

        ! Subroutines and functions
    public subroutine comb_error (error_code, procedure, comment_add, comment_out, halt_in)

end module comb_error_mod
Functionality to handle errors that may occur in the comb library. Public comb error codes are defined, with corresponding private error comments and default halt execution status.

Author: J. D. McEwen (mcewen[AT]mrao.cam.ac.uk)

Version: 0.1 August 2004


Description of Variables

COMB_ERROR_NUM

integer, private, parameter :: COMB_ERROR_NUM = 9

COMB_ERROR_NONE

integer, public, parameter :: COMB_ERROR_NONE = 0

COMB_ERROR_INIT

integer, public, parameter :: COMB_ERROR_INIT = 1

COMB_ERROR_NOT_INIT

integer, public, parameter :: COMB_ERROR_NOT_INIT = 2

COMB_ERROR_INIT_FAIL

integer, public, parameter :: COMB_ERROR_INIT_FAIL = 3

COMB_ERROR_OBJ_MOTHER_INVALID

integer, public, parameter :: COMB_ERROR_OBJ_MOTHER_INVALID = 4

COMB_ERROR_CSKY_LMAX_NOT_DEF

integer, public, parameter :: COMB_ERROR_CSKY_LMAX_NOT_DEF = 5

COMB_ERROR_CSIM_NARG

integer, public, parameter :: COMB_ERROR_CSIM_NARG = 6

COMB_ERROR_CSIM_PARAM_INVALID

integer, public, parameter :: COMB_ERROR_CSIM_PARAM_INVALID = 7

COMB_ERROR_TMPL_PARAM_INVALID

integer, public, parameter :: COMB_ERROR_TMPL_PARAM_INVALID = 8

error_comment

character (len=S2_STRING_LEN), private, parameter, dimension (COMB_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Invalid comb mother obj to generate new obj from                         ', 'Lmax not defined when required                                           ', 'Invalid number of input parameters                                       ', 'Invalid input parameter                                                  ', 'Invalid number of input parameters in template function                  ' /)
Comment associated with each error type.

halt_default

logical, private, parameter, dimension (COMB_ERROR_NUM) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .true., .true. /)
Default program halt status of each error type.

Description of Subroutines and Functions

comb_error

public subroutine comb_error (error_code, procedure, comment_add, comment_out, halt_in)
    integer, intent(in) :: error_code
    character (len=*), optional, intent(in) :: procedure
    character (len=*), optional, intent(in) :: comment_add
    character (len=*), optional, intent(inout) :: comment_out
    logical, optional, intent(in) :: halt_in
end subroutine comb_error
Display error message corresponding to error_code and halt program execution if required.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004