A collection of tools used for error handling. These tools provide a linked list class which can help a user both understand where an error happened and also help the developer to correct for the errors.
- Documentation: https://aea.re-pages.lanl.gov/material-models/tardigrade_error_tools
- Wiki: https://re-git.lanl.gov/aea/material-models/tardigrade_error_tools/-/wikis/home
- Nathan Miller [email protected]
- Kyle Brindley [email protected]
- CMake >= 3.14
- Doxygen >= 1.8.5
- Sphinx >= 3.0.4
- Breathe >= 4.30.0
- sphinx_rtd_theme >= 0.4.3
For convenience, the minimal Python environment requirements for the
documentation build are included in environment.txt
. A minimal anaconda
environment for building the documentation can be created from an existing
anaconda installation with the following commands.
$ conda create --file environment.txt
Warning
API Health Note: The Sphinx API docs are a work-in-progress. The doxygen API is much more useful
Activate a [W-13 Python Environment](https://xcp-confluence.lanl.gov/display/PYT/The+W-13+Python+3+environment)
$ sv3r
Create the build directory and move there
$ cd build/
Run cmake configuration
$ cmake ..
Build the docs
$ cmake --build docs
Sphinx HTML Documentation builds to:
tardigrade_error_tools/build/docs/sphinx/html/index.html
Display docs
$ firefox docs/sphinx/html/index.html &
While the Sphinx API is still a WIP, try the doxygen API
$ firefox docs/doxygen/html/index.html &
Follow the steps for building the documentation and pick up below.
Build just the library
$ pwd /path/to/tardigrade_error_tools/build $ cmake --build src/cpp
The library can be used as a header-only library by defining the pre-processor
variable TARDIGRADE_HEADER_ONLY
. This can be helpful for code optimization
purposes or if in-lining the code is otherwise important. Additionally, the error
handling can be turned off by defining the pre-processor variable TARDIGRADE_ERROR_TOOLS_OPT
.
Both of these variable can be independently accessed through cmake via
$ pwd /path/to/tardigrade_error_tools/build $ cmake --build src/cpp -DTARDIGRADE_HEADER_ONLY=ON -DTARDIGRADE_ERROR_TOOLS_OPT=ON
Build the entire before performing the installation.
Build the entire project
$ pwd /path/to/tardigrade_error_tools/build $ cmake --build . --target all
Install the library
$ pwd /path/to/tardigrade_error_tools/build $ cmake --install . --prefix path/to/root/install # Example local user (non-admin) Linux install $ cmake --install . --prefix /home/$USER/.local # Example install to conda environment $ cmake --install . --prefix path/to/conda/environment/ # Example install to W-13 CI/CD conda environment performed by CI/CD institutional account $ cmake --install . --prefix /projects/aea_compute/release
A python interface to the tardigrade_error_tools
C++ routines is provided. After the
libraries have been built, they can be linked so that they can be called with
python.
Build the libraries
$ pwd /path/to/tardigrade_error_tools/build $ cmake --build . --target all
Activate a [W-13 Python Environment](https://xcp-confluence.lanl.gov/display/PYT/The+W-13+Python+3+environment)
$ sv3r
in the
src/python
directory build the interface usingcython
$ python setup.py build_ext --inplace
The error tools interfaces can be used in a number of ways that automate try-catch exception handling. The three
major macros are TARDIGRADE_ERROR_TOOLS_CATCH
, TARDIGRADE_ERROR_TOOLS_CHECK
, and TARDIGRADE_ERROR_TOOLS_EVAL
.
TARDIGRADE_ERROR_TOOLS_CATCH
This macro evaluates the provided function or expression and, if it throws an exception, creates a nested
exception stack trace. If TARDIGRADE_ERROR_TOOLS_OPT
is defined, the expression will still be evaluated.
TARDIGRADE_ERROR_TOOLS( myFunction( first_parameter, second_parameter, ... ) )
TARDIGRADE_ERROR_TOOLS_CHECK
This macro evaluates a provided expression and throws an exception if the expression is false. This is useful
as the root error handling object. If TARDIGRADE_ERROR_TOOLS_OPT
is defined, the expression will not be
evaluated.
TARDIGRADE_ERROR_TOOLS_CHECK( myExpression, "My error message" )
TARDIGRADE_ERROR_TOOLS_EVAL
This macro evaluates the provided expression and will not be evaluated if TARDIGRADE_ERROR_TOOLS_OPT
is defined.
TARDIGRADE_ERROR_TOOLS_EVAL( myFirstExpression; mySecondExpression; )