Skip to main content

Manage error codes, descriptions and data in a unified way throughout a project

Project description

Managing error codes throughout you project

Error-manager is a simple library for Python to manage all your projects error codes.

docs

Documentation Status

tests

Coverage Status

package

PyPI Package latest release Commits since latest release

error-manager main use cases

Main use case for the error-manager package is to implement a ListErrors class that can be used throughout your project to define and access immutable standard error codes and descriptions

# retrieve customer defined ErrorCode object form ``ListErrors`` class
>>> from errors.error import ListErrors
>>> ListErrors.API_GET_RETURNED_404
ErrorCode(
    code='ER_API404_00001',
    description='API get request returned 404',
    error_data={})

# add custom error data to error message when you want to persist or log the error
# As the errorcode are immutable the add_error_data returns a new error (immutable) error code.
>>> from errors.base import add_error_data
>>> error_without_data = ListErrors.API_GET_RETURNED_404
>>> error_with_data = add_error_data(error_without_data, {'url': 'www.bad_url.com'})
>>> error_with_data
ErrorCode(
    code='ER_API404_00001',
    description='API get request returned 404',
    error_data={'url': 'www.bad_url.com'})

This ErrorCode could be returned by the method performing the request so that the logic calling this method is aware of the failing request.

In order to use a single type as return value the error-manager package introduces a ReturnValue class that can hold the actual response, any possible downstream errors and the status of the return value. See ReturnValue documentation.

Documentation

https://errors.readthedocs.io/

Changelog

1.4.0 (2024-05-23)

  • Added ErrorListByMixin class to support autocompletion and type checking of your custom project errors

1.3.2 (2023-10-23)

  • Added support for python 3.12

1.3.1 (2023-10-20)

  • Refactored setup.cfg and pyproject.toml

1.3.0 (2022-11-01)

  • Added type annotations

1.2.4 (2022-10-26)

  • Added support for python 3.11

1.2.2 (2022-05-09)

  • Added ReturnValueWithErrorStatus to __init__ for easy import.

1.2.1 (2022-05-08)

  • Added a class ReturnValueWithErrorStatus to easily create ReturnValueWithStatus with a error attached to it.

1.2.0 (2022-05-06)

  • Added a dataclass ReturnValueWithStatus to allow consuming classes and methods to return a single return type with result, status and errors collected in one Object

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

1.1.0 (2021-11-05)

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

1.0.0 (2021-10-12)

  • Added Documentation and removed more default but redundant Documentation

  • Added reference documentation for ListErrors and base module

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

0.1.0 (2021-10-08)

  • First release on PyPI.

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.4.3.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

error_manager-1.4.3-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file error_manager-1.4.3.tar.gz.

File metadata

  • Download URL: error_manager-1.4.3.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for error_manager-1.4.3.tar.gz
Algorithm Hash digest
SHA256 ab8e702141e3327e51b73bf0694ec252f44170a8f861a585779825becce15748
MD5 d700b3ad409260461caa1072e789cfc2
BLAKE2b-256 d642c2ebb4da28f23aaaa5cf8268c69fc3f3725f987eb910a2415987fc258372

See more details on using hashes here.

File details

Details for the file error_manager-1.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for error_manager-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2ff289c513faae7a540f4de75d690722b626eb08bace62641793d06c97f5d54e
MD5 82a07bf2039b626ef65b45808c27ab2b
BLAKE2b-256 3839a64dd4e93283d52d3eeb30f173daa64694393a4c5e987632148613f4560a

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