MCPcopy
hub / github.com/django/django / check_errors

Function check_errors

django/utils/autoreload.py:61–85  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

59
60
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
87
88def raise_last_exception():

Callers 1

start_djangoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected