Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

noraise

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noraise

noraise

  • 0.0.16
  • PyPI
  • Socket score

Maintainers
1

noraise

PyPI - package version PyPI - license PyPI - python version PyPI - downloads

GitHub - last commit GitHub - commit activity

GitHub - code size in bytes GitHub - repo size GitHub - lines of code

GitHub - license

Description

Lightweight utility package, that provides a function decorator to easily catch and print exceptions

Supported Args

nametypedefault valuedescription
print_excboolTrueIf True, prints stacktrace
return_exceptionboolFalseIf True, returns caught exception
default_return_valueOptional[any]NoneWhat to return upon caught exception if
'return_exception' is False
ignored_error_typesOptional[List[Exception]]NoneIn which cases should the stacktrace print
be skipped if 'print_exc' is True

Install

pip install noraise
# or
pip3 install noraise

Usage

from noraise import noraise

@noraise(print_exc=True, return_exception=True, ignored_error_types=[ZeroDivisionError])
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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc