Decorator error mapper
Project description
Description
Decorator 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
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
error_mapper-0.0.1.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for error_mapper-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41f42e210bf20327cded6fd051ef6bdefb025a2c0111dd8ad3ada486c28bafb7 |
|
MD5 | f6b76ad219cf4c0dd894c9ff2e80a3c0 |
|
BLAKE2b-256 | 2eeb29387fdeeeadc3f57c925e9c31bee667ad2674eb1849b71218d5418e9472 |