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:
- Wiki:
- Nathan Miller [email protected]
- Kyle Brindley [email protected]
The developer dependencies are found in environment.txt.
$ conda create --name tardigrade_error_tools-dev --file environment.txtWarning
API Health Note: The Sphinx API docs are a work-in-progress. The doxygen API is much more useful
$ pwd
/path/to/tardigrade_error_tools
$ cmake -S . -B build
$ cmake --build build --target Doxygen SphinxFollow the steps for building the documentation and pick up below.
Build just the library
$ pwd /path/to/tardigrade_error_tools $ cmake -S . -B build $ cmake --build build --target tardigrade_error_tools
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 $ cmake -S . -B build $ cmake --build build --target tardigrade_error_tools -DTARDIGRADE_HEADER_ONLY=ON -DTARDIGRADE_ERROR_TOOLS_OPT=ON
$ pwd
/path/to/tardigrade_error_tools
$ cmake -S . -B build
$ cmake --build build --target tardigrade_error_tools test_tardigrade_error_tools
$ ctest --test-dir build
Build the entire project before performing the installation.
Build the entire project
$ pwd /path/to/tardigrade_error_tools $ cmake -S . -B build $ cmake --build build --target all
Install the library
$ pwd /path/to/tardigrade_error_tools $ cmake --install build --prefix path/to/root/install # Example local user (non-admin) Linux install $ cmake --install build --prefix /home/$USER/.local # Example install to an active conda environment $ cmake --install build --prefix $CONDA_PREFIX
$ VERSION=$(python -m setuptools_scm) conda mambabuild recipe --no-anaconda-upload -c conda-forge --output-folder conda-bldA 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.
TODO
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; )