Error-mapper
Python error mapper based on decorators.
Installing
pip install error-mapper
Example
Error map
from error_mapper import ErrorMapType, error_map_decorator
class SuppressedError(Exception): ...
class RaiseError(Exception): ...
error_map: ErrorMapType = {
SuppressedError: RaiseError,
}
@error_map_decorator(error_map, RaiseError)
def fn() -> None:
raise SuppressedError
On error execute
from error_mapper import ErrorMapTypeExecute, on_error_execute
class SuppressedError(Exception): ...
class RaiseError(Exception): ...
def process_error(error: Exception) -> tp.NoReturn:
raise RaiseError from error
error_map: ErrorMapTypeExecute = {
SuppressedError: process_error,
}
@on_error_execute(error_map, RaiseError)
def fn() -> None:
raise SuppressedError
Suppress error to None
from error_mapper import suppress_to_none
class SuppressedError(Exception): ...
class RaiseError(Exception): ...
@suppress_to_none(SuppressedError)
def fn() -> None:
raise SuppressedError
assert fn() is None
Testing, linting, formatting
rye testrye lintrye fmt
Metadata
Release files for error-mapper 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| error_mapper-1.0.6.tar.gz | 7.9 kB | Without provenance | Details for error_mapper-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| error_mapper-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for error_mapper-1.0.6-py3-none-any.whl |
Total release size: 17.2 kB
Release files / error_mapper-1.0.6.tar.gz
| Download URL | error_mapper-1.0.6.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fb9c1128c54d73a6cf7586271f76bb4d1d7c10314ea4c7d7b2cc6ef793b9288
|
|
BLAKE2b-256 checksum How to use checksums |
c45d8f630dda4644a8bdb973375076007cec44a9be2eefcb042ad2deb280815c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Release files / error_mapper-1.0.6-py3-none-any.whl
| Download URL | error_mapper-1.0.6-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65d764ecdedc3adcbaa8ab718cf148fdcf23b151e2345530f5c8dbf4b477c384
|
|
BLAKE2b-256 checksum How to use checksums |
fe8b456c490dab9578b596cd75a6b39d53b0306da6bf7f5653b8c840572a0aba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Security for error-mapper 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.