halerror

This python library implements a sci-fi exception class!

Installation

The package is available from PyPI. To install using pip, do the following:

pip install halerror

To install from source, clone the GitHub repository and then do the following:

python setup.py install

Testing

To run the tests, download the source code and do the following:

python setup.py test

Building the documentation

To build this documenation, download the source code and the do the following:

pip install -e .[build_sphinx]
python setup.py build_sphinx

Usage examples

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

API documentation

Please check out the API documentation here.

Issues

Please use the GitHub issue tracker to submit bugs or request features.

License

Copyright James Parkhurst, 2019.

BSD 2-Clause License

Copyright (c) 2019, James Parkhurst
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Indices and tables