Skip to main content

Module to manage error code, descriptions and data in a unified way throughout a project

Project description

A lightweight implementation of a manager for error messages throughout your project. Allows you to easily define and register error codes and messages. Enable easy access to a single list of registerd error codes and messages throughout your project.

  • Free software: GNU Lesser General Public License v3 or later (LGPLv3+)

Installation

pip install error-manager

You can also install the in-development version with:

pip install https://github.com/MaartendeRuyter/errors/archive/master.zip

Main usecases

Error manager provides you with a ListErrors class to retrieve your custom error codes and descriptions throughout your project:

# retrieve customer defined ErrorCode object form ``ListErrors`` class
>>> from errors.error import ListErrors
>>> error = ListErrors.COULD_NOT_FIND_ERROR_CODE
>>> error
ErrorCode(code='ER_GETERROR_00001', description='Could not find requested
error code', error_data=<class 'dict'>)

# add custom error data to error message when you want to persist or log
# the error
>>> from errors.base import add_error_data
>>> error_with_data = add_error_data(error, {'key': 'Example error data'})
>>> error_with_data
ErrorCode(code='ER_GETERROR_00001', description='Could not find requested error code', error_data={'key': 'Example error data'})

Documentation

https://errors.readthedocs.io/

Changelog

0.1.0 (2021-10-08)

  • First release on PyPI.

0.9.0 (2021-10-11)

  • added error codes as attribut to ListErrors class. After registration of an ErrorCode the errorcode is accessible in ListErrors via:

    ListErrors.ERROR_CODE_KEY
  • Added Documentation and removed default redundant Documentation

1.0.0 (2021-10-12)

  • Added Documentation and removed more default but redundant Documentation

  • Added reference documentation for ListErrors and base module

1.1.0 (2021-11-05)

  • Added is_error method to check if an object is an instance of (sub)class ErrorCode

1.1.1 (2021-11-06)

  • Import ListErrors, ErrorCode, add_error_data() and is_error() in errors __init__.py so that they can be directly imported from errors module

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

error-manager-1.1.1.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

error_manager-1.1.1-py2.py3-none-any.whl (20.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file error-manager-1.1.1.tar.gz.

File metadata

  • Download URL: error-manager-1.1.1.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for error-manager-1.1.1.tar.gz
Algorithm Hash digest
SHA256 fb828e8f6ad931a1024340a6ce0bc4d3eb5c33b12f1d25dee5ee295d934c14e3
MD5 ea6c2cd3002580697b528ed601b276a2
BLAKE2b-256 f4f2e1d23c6f269240cd6b882e1a26f7f2658b9a1e49e91c6a12abd90dcd8911

See more details on using hashes here.

File details

Details for the file error_manager-1.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: error_manager-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for error_manager-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d8275c616b5bca23333cc37650ac50f952bf25ff4acafb952e9047022e746157
MD5 b13fa22efb17d96ad94603ddf0cdf45b
BLAKE2b-256 de0d16f2e38268d6550a07380a1e451251254af38717aa3a4afefa8747c3c446

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