What's Changed
- fixed typing
- fixed other small bugs
* Develop by tybruno in https://github.com/tybruno/zombie-py/pull/9
**Full Changelog**: https://github.com/tybruno/zombie-py/compare/v1.2...v1.3
Installation
To install the package, use the following command:
shell
pip install zombie-py
Usage Examples
Using as a Context Manager
python
from zombie import ExceptionTransformation, Reraise
transform = ExceptionTransformation(
original_exception=KeyError,
new_exception=ValueError,
)
with Reraise(transform):
raise KeyError('Original error message')
Using as a Decorator
python
from zombie import ExceptionTransformation, Reraise
transforms = [
ExceptionTransformation(
original_exception=KeyError,
new_exception=ValueError,
error_message='A KeyError occurred',
raise_from_error=True,
),
ExceptionTransformation(
original_exception=TypeError,
new_exception=RuntimeError,
error_message='A TypeError occurred',
raise_from_error=True,
),
]
Reraise(transforms)
def func():
raise KeyError('Original error message')
func()
Bug Fixes
- None
Known Issues
- None
Contributors
- Tyler Bruno