Skip to main content

Python utilities used for handling and raising exceptions

Project description

Christopher H. Todd's PROJECT_STRING_NAME

The PROJECT_GIT_NAME project is responsible for ...

The library ...

Table of Contents

Dependencies

Python Packages

  • N/A

Libraries

create_exceptions.py

Exception Helpers. This file shows exception types in Python and function calls for generating specific exceptions. This can be useful for unittesting, debugging, and other tasks that might call for purposefully breaking parts of your code.

Functions:

def create_and_throw_exception(exception_name=None):
    """
        Purpose:
            Create and Throw an exception from the exception
            types in the file. if exception_name is passed in,
            throw that specific exception if it has been
            coded in the library
        Args:
            exception_name (String ExceptionType): Type of exception
                to throw
        Returns:
            N/A: should never return, should always raise
    """
def create_zero_division_exception():
    """
        Purpose:
            Throw ZeroDivisionError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_overflow_exception():
    """
        Purpose:
            Throw OverflowError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_type_exception():
    """
        Purpose:
            Throw TypeError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_assertion_exception():
    """
        Purpose:
            Throw AssertionError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_attribute_exception():
    """
        Purpose:
            Throw AttributeError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_name_exception():
    """
        Purpose:
            Throw NameError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_index_exception():
    """
        Purpose:
            Throw IndexError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_key_exception():
    """
        Purpose:
            Throw KeyError Exception
        Args:
            N/A
        Returns:
            N/A
    """
def create_unbound_local_exception():
    """
        Purpose:
            Throw UnboundLocalError Exception
        Args:
            N/A
        Returns:
            N/A
    """

unsupported_exception.py

UnsupportedException Class. Currently Does Nothing, but allows for sepcific callouts of failures in create_exceptions

Classes:

class UnsupportedException(Exception):
    """
    Purpose:
        An Unsupported Exception is raised when the lib is asked to try
        and raise an exception that has yet to be programmed. this way,
        som exception is raised, but it can be handled in a way that
        knows the specified exception isn't raised
    """

Example Scripts

Example executable Python scripts/modules for testing and interacting with the library. These show example use-cases for the libraries and can be used as templates for developing with the libraries or to use as one-off development efforts.

N/A

Notes

  • Relies on f-string notation, which is limited to Python3.6. A refactor to remove these could allow for development with Python3.0.x through 3.5.x

TODO

  • Unittest framework in place, but lacking tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctodd-python-lib-exceptions-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file ctodd-python-lib-exceptions-1.0.0.tar.gz.

File metadata

  • Download URL: ctodd-python-lib-exceptions-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for ctodd-python-lib-exceptions-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0fdf500f3499ed1d49740591f8e1337e0506f81356f5750c3d87c1def74cf853
MD5 34ce6c025aeb6b380d08fd2beed8b054
BLAKE2b-256 9eca53ba7de1763ac0527cef926cd7fec3982037448552ac82e6346e80b92f09

See more details on using hashes here.

File details

Details for the file ctodd_python_lib_exceptions-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ctodd_python_lib_exceptions-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

File hashes

Hashes for ctodd_python_lib_exceptions-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08e3f331b62a577acb3566cdaa4574fa25c9a0a1c826070c6ef55affea94f454
MD5 eab3efe3bf725c5ed9ab4a334b9114ed
BLAKE2b-256 575138adf14e77e52afc727c3e4d0c978131384c60097b198847abb352f831d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page