The best python exception library
This python library implements a sci-fi exception class!
The package is available from PyPI. To install using pip, do the following:
pip install halerror
To install from source, clone this repository and then do the following:
python setup.py install
To run the tests, clone this repository and the do the following:
python setup.py test
To build the documenation, clone this repository and the do the following:
pip install -e .[build_sphinx]
python setup.py build_sphinx
The exception class can be used as follows:
from halerror import HalError
def open_pod_bay_doors():
raise HalError("Open the pod bay doors, HAL.")
open_pod_bay_doors()
This will result in the following error output, where ${NAME} is the username of the person running the software:
halerror.HalError: Open the pod bay doors, HAL
I'm sorry, ${NAME}. I'm afraid I can't do that.
Having all your exceptions formatted like this is as easy as adding the following lines to your code
from halerror import HalError
try:
open_pod_bay_doors()
except Exception as error:
raise HalError(error) from error
You can find the full documentation on Read the Docs.
Please use the GitHub issue tracker to submit bugs or request features.
Copyright James Parkhurst, 2019.
Distributed under the terms of the BSD license, halerror is free and open source software.