File: LP6E/AppendixB/Part7/exctools_deco.py
import sys, traceback
def safe(callee):
def callproxy(*pargs, **kargs):
try:
return callee(*pargs, **kargs)
except Exception as E:
traceback.print_exc()
print(f'Got {E.__class__} {E}')
return callproxy
if __name__ == '__main__':
import oops2
@safe
def test(): # test = safe(test)
oops2.oops()
test()