noraise
Project description
noraise
Description
Lightweight utility package, that provides a function decorator to easily catch and print exceptions
Install
pip install noraise
# or
pip3 install noraise
Usage
from noraise import noraise
@noraise(print_exc=True, return_exception=True)
def f2():
return 1/0
res = f2()
print(type(res), res)
# This will not catch the crash, and print
#
#
# < ----------------------------------------------- Caught with @noraise ---------------------------------------------- >
#
# Traceback (most recent call last):
# File "/Users/kristofk/github/py_noraise/noraise/noraise.py", line 32, in wrapper
# return function(*args, **kwargs)
# File "demo.py", line 5, in f2
# return 1/0
# ZeroDivisionError: division by zero
#
# < -------------------------------------------------------------------------------------------------------------------- >
#
#
# <class 'ZeroDivisionError'> division by zero
Dependencies
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
noraise-0.0.12.tar.gz
(3.4 kB
view hashes)