1 2 3 4 5 6 7 8 9 10 11 12 13 | import traceback
def catch(func):
"""
Catches any exception and prints a stack trace.
"""
def wrapper(*args,**kwargs):
try:
return func(*args,**kwargs)
except:
traceback.print_exc()
return wrapper
|
More like this
- function tracing decorator by amitu 4 years, 3 months ago
- Print Exceptions to the Console by ericflo 3 years, 10 months ago
- Other approach of making middleware (by decorators) by diverman 2 years, 3 months ago
- Accessing Environment Variables in Views by LorenDavie 4 years, 10 months ago
- Accessing Environment Variables in Templates by LorenDavie 4 years, 10 months ago
Comments