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 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 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
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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file error-manager-1.2.0.tar.gz
.
File metadata
- Download URL: error-manager-1.2.0.tar.gz
- Upload date:
- Size: 35.4 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a02fe121f4b0e7668d1468e6fa40e6fb133f19feebf1d6d33642533d5de6713 |
|
MD5 | 20a783c032b47a32cbc17b94cb383c09 |
|
BLAKE2b-256 | 074ad3c79d3d8fcb4f853be00909a7180dd4f700f6151b33979df1774bd97e94 |
File details
Details for the file error_manager-1.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: error_manager-1.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 20.8 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a357557351a89318bee6bbf39bc2b645df5077ab8c2999e24de111fe11013c7e |
|
MD5 | b6d004c091bd0f8d6187d1863f25ae22 |
|
BLAKE2b-256 | a2bdc58ac1e6311d1d1329908ddc820022ac3429817fae0302ea798144f21568 |