ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_err Module Reference

This module contains classes and procedures for reporting and handling errors.
More...

Data Types

interface  err_type
 This is the derived type for generating objects to gracefully and verbosely handle runtime unexpected behavior in the ParaMonte library.
More...
 
interface  getFile
 Generate and return a decorated string as "@file(FILE)" where FILE is replaced by the input source file of interest.
More...
 
interface  getFine
 Generate and return a decorated string resulting from the concatenation of getFile(FILE) and getLine(LINE) where FILE and LINE are replaced by the specified input source file and line of interest.
More...
 
interface  getLine
 Generate and return a decorated string as "@line(LINE)" where LINE is replaced by the input source line of interest.
More...
 
type  mark_type
 This is the derived type for constructing objects that contain the specifications of the generic interface setMarked along with a dynamic method show that acts as a convenience wrapper around the generic interface setMarked.
More...
 
type  message_type
 This is the base derived type for constructing subclasses that contain the specifications of the generic message interfaces.
More...
 
type  note_type
 Generate and return an object of type mark_type with the user-specified input attributes. More...
 
interface  setAborted
 Write the input string in the format of a fatal error to the output, then call error stop or return the control to the caller if requested.
More...
 
interface  setAsserted
 Verify the input assertion holds and if it does not, print the (optional) input message on stdout and halt the program via error stop or (optionally) return the program control to the caller routine, if requested.
More...
 
interface  setMarked
 Write the input string in the format of a custom notification, warning, or other types of messages to the output.
More...
 
interface  setNoted
 Write the input string in the format of a notification to the output.
More...
 
interface  setWarned
 Write the input string in the format of a warning to the output.
More...
 
interface  show
 Generate and return an object of type stop_type with the user-specified input attributes. More...
 
type  stop_type
 Generate and return an object of type warn_type with the user-specified input attributes. More...
 
type  warn_type
 Generate and return an object of type note_type with the user-specified input attributes. More...
 

Variables

character(*, SK), parameter MODULE_NAME = "@pm_err"
 
logical(LK), parameter SOFT_EXIT_ENABLED = .false._LK
 The scalar logical of default kind LK.
If .true., the setAborted generic interface avoid calling the Fortran error stop statement upon detecting the occurrence of an error.
Instead it return the program control to the caller procedure for further actions.
This flag is important for testing the parallel implementations of the routines of the ParaMonte library.
More...
 
integer(IK) STATNULL = -huge(0_IK)
 The scalar integer of default kind IK containing the null value initially assigned to the stat component of the err_type.
It is used to detect and control the printing of the compiler error stat number if any exists.
More...
 

Detailed Description

This module contains classes and procedures for reporting and handling errors.

Note
There is a subtle difference between the impure setAsserted and the impure setAborted generic interfaces.
  1. The setAsserted procedures are frequently used internally within the various components of the ParaMonte library to assert a runtime condition.
    Many of the assertions are related to the testing of the library.
    Frequently however, the library procedures contain runtime checks that call setAsserted when the library is built with the preprocessing flag CHECK_ENABLED=1.
    The failure of an assertion within setAsserted usually implies a more severe low-level error in the library.
    The default behavior of setAsserted in such cases is to call error stop to halt the program unless it is specifically overridden by the user (via the input argument renabled).
  2. By contrast, setAborted should be usually called when an assertion is known to have failed before calling setAborted.
    Furthermore, the default behavior of the program upon encountering an error depends on the compile-time constant SOFT_EXIT_ENABLED whose value depends on the build type and target programming language environment of the library (C, C++, Fortran, Java, Julia, MATLAB, Python, R, ...).
    This behavior is critical for graceful handling of runtime errors in dynamic languages where a call to error stop shuts down the entire dynamic session causing data loss and wasting user time.
    Additionally, setAborted allows flexible formatting of the output message in both the stdout and an output unit specified by the user.

test_pm_err


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, 3:43 AM Friday, March 1, 2013, Institute for Fusion Studies, The University of Texas at Austin

Variable Documentation

◆ MODULE_NAME

character(*, SK), parameter pm_err::MODULE_NAME = "@pm_err"

Definition at line 58 of file pm_err.F90.

◆ SOFT_EXIT_ENABLED

logical(LK), parameter pm_err::SOFT_EXIT_ENABLED = .false._LK

The scalar logical of default kind LK.
If .true., the setAborted generic interface avoid calling the Fortran error stop statement upon detecting the occurrence of an error.
Instead it return the program control to the caller procedure for further actions.
This flag is important for testing the parallel implementations of the routines of the ParaMonte library.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, 3:43 AM Friday, March 1, 2013, Institute for Fusion Studies, The University of Texas at Austin

Definition at line 79 of file pm_err.F90.

◆ STATNULL

integer(IK) pm_err::STATNULL = -huge(0_IK)

The scalar integer of default kind IK containing the null value initially assigned to the stat component of the err_type.
It is used to detect and control the printing of the compiler error stat number if any exists.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, 3:43 AM Friday, March 1, 2013, Institute for Fusion Studies, The University of Texas at Austin

Definition at line 98 of file pm_err.F90.