92 use,
intrinsic :: iso_fortran_env, only : int32
100 character(len = 256),
private :: m_fname =
"error_log.txt"
101 logical,
private :: m_foundError = .false.
102 logical,
private :: m_foundWarning = .false.
103 integer(int32),
private :: m_errorFlag = 0
104 integer(int32),
private :: m_warningFlag = 0
105 logical,
private :: m_exitOnError = .true.
106 logical,
private :: m_suppressPrinting = .false.
107 character(len = :),
private,
allocatable :: m_errorMessage
108 character(len = :),
private,
allocatable :: m_warningMessage
109 character(len = :),
private,
allocatable :: m_eFunName
110 character(len = :),
private,
allocatable :: m_wFunName
111 procedure(error_callback),
private,
pointer, pass :: m_errCleanUp => null()
358 procedure,
public :: get_clean_up_routine => er_get_err_fcn_ptr
369 procedure,
public :: set_clean_up_routine => er_set_err_fcn_ptr
379 class(errors),
intent(in) :: err
382 class(*),
intent(inout) :: obj
388 pure module function er_get_log_filename(this) result(str)
389 class(errors),
intent(in) :: this
390 character(len = :),
allocatable :: str
393 module subroutine er_set_log_filename(this, str)
394 class(errors),
intent(inout) :: this
395 character(len = *),
intent(in) :: str
399 module subroutine er_report_error(this, fcn, msg, flag, obj)
400 class(errors),
intent(inout) :: this
401 character(len = *),
intent(in) :: fcn, msg
402 integer(int32),
intent(in) :: flag
403 class(*),
intent(inout),
optional :: obj
406 module subroutine er_report_warning(this, fcn, msg, flag)
407 class(errors),
intent(inout) :: this
408 character(len = *),
intent(in) :: fcn, msg
409 integer(int32),
intent(in) :: flag
412 module subroutine er_log_error(this, fcn, msg, flag)
413 class(errors),
intent(in) :: this
414 character(len = *),
intent(in) :: fcn, msg
415 integer(int32),
intent(in) :: flag
418 pure module function er_has_error_occurred(this) result(x)
419 class(errors),
intent(in) :: this
423 module subroutine er_reset_error_status(this)
424 class(errors),
intent(inout) :: this
427 pure module function er_has_warning_occurred(this) result(x)
428 class(errors),
intent(in) :: this
432 module subroutine er_reset_warning_status(this)
433 class(errors),
intent(inout) :: this
436 pure module function er_get_error_flag(this) result(x)
437 class(errors),
intent(in) :: this
441 pure module function er_get_warning_flag(this) result(x)
442 class(errors),
intent(in) :: this
446 pure module function er_get_exit_on_error(this) result(x)
447 class(errors),
intent(in) :: this
451 module subroutine er_set_exit_on_error(this, x)
452 class(errors),
intent(inout) :: this
453 logical,
intent(in) :: x
456 pure module function er_get_suppress_printing(this) result(x)
457 class(errors),
intent(in) :: this
461 module subroutine er_set_suppress_printing(this, x)
462 class(errors),
intent(inout) :: this
463 logical,
intent(in) :: x
466 module function er_get_err_msg(this) result(msg)
467 class(errors),
intent(in) :: this
468 character(len = :),
allocatable :: msg
472 module function er_get_warning_msg(this) result(msg)
473 class(errors),
intent(in) :: this
474 character(len = :),
allocatable :: msg
478 module function er_get_err_fcn(this) result(fcn)
479 class(errors),
intent(in) :: this
480 character(len = :),
allocatable :: fcn
484 module function er_get_warning_fcn(this) result(fcn)
485 class(errors),
intent(in) :: this
486 character(len = :),
allocatable :: fcn
490 module subroutine er_get_err_fcn_ptr(this, ptr)
491 class(errors),
intent(in) :: this
492 procedure(error_callback),
intent(out),
pointer :: ptr
495 module subroutine er_set_err_fcn_ptr(this, ptr)
496 class(errors),
intent(inout) :: this
497 procedure(error_callback),
intent(in),
pointer :: ptr
bool get_exit_on_error(const error_handler *err)
Gets a logical value determining if the application should be terminated when an error is encountered...
int get_error_flag(const error_handler *err)
Gets the current error flag.
void set_log_filename(error_handler *err, const char *fname)
Sets the error log filename.
bool has_warning_occurred(const error_handler *err)
Tests to see if a warning has been encountered.
void report_warning(error_handler *err, const char *fcn, const char *msg, int flag)
Reports a warning condition to the user.
void reset_warning_status(error_handler *err)
Resets the warning status flag to false, and the current warning flag to zero.
void reset_error_status(error_handler *err)
Resets the error status flag to false, and the current error flag to zero.
bool has_error_occurred(const error_handler *err)
Tests to see if an error has been encountered.
void set_suppress_printing(error_handler *err, bool x)
Sets a logical value determining if printing of error and warning messages should be suppressed.
void log_error(const error_handler *err, const char *fcn, const char *msg, int flag)
Writes an error log file.
void report_error(error_handler *err, const char *fcn, const char *msg, int flag)
Reports an error condition to the user.
void get_warning_fcn_name(const error_handler *err, char *fname, int *nfname)
Gets the name of the function or subroutine that issued the last warning message.
void get_log_filename(const error_handler *err, char *fname, int *nfname)
Gets the name of the error log file.
void get_error_message(const error_handler *err, char *msg, int *nmsg)
Gets the current error message.
int get_warning_flag(const error_handler *err)
Gets the current warning flag.
void get_error_fcn_name(const error_handler *err, char *fname, int *nfname)
Gets the name of the function or subroutine that issued the last error message.
void get_warning_message(const error_handler *err, char *msg, int *nmsg)
Gets the current warning message.
void set_exit_on_error(error_handler *err, bool x)
Sets a logical value determining if the application should be terminated when an error is encountered...
bool get_suppress_printing(const error_handler *err)
Gets a logical value determining if printing of error and warning messages should be suppressed.
Defines the signature of a routine that can be used to clean up after an error condition is encounter...
Defines a type for managing errors and warnings.