MCPcopy
hub / github.com/django/django / wrapper

Function wrapper

django/utils/autoreload.py:63–83  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

61def check_errors(fn):
62 @wraps(fn)
63 def wrapper(*args, **kwargs):
64 global _exception
65 try:
66 fn(*args, **kwargs)
67 except Exception as e:
68 _exception = sys.exc_info()
69
70 et, ev, tb = _exception
71
72 if getattr(ev, "filename", None) is None:
73 # get the filename from the last item in the stack
74 filename = traceback.extract_tb(tb)[-1][0]
75 else:
76 filename = ev.filename
77
78 if filename not in _error_files:
79 _error_files.append(filename)
80 if _url_module_exception is not None:
81 raise e from _url_module_exception
82
83 raise e
84
85 return wrapper
86

Callers

nothing calls this directly

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected