diff --git a/frappe/recorder.py b/frappe/recorder.py index 388efcbf6e..e3eef94809 100644 --- a/frappe/recorder.py +++ b/frappe/recorder.py @@ -53,16 +53,18 @@ def sql(*args, **kwargs): def get_current_stack_frames(): - current = inspect.currentframe() - frames = inspect.getouterframes(current, context=10) - for frame, filename, lineno, function, context, index in list(reversed(frames))[:-2]: - if "/apps/" in filename: - yield { - "filename": re.sub(".*/apps/", "", filename), - "lineno": lineno, - "function": function, - } - + try: + current = inspect.currentframe() + frames = inspect.getouterframes(current, context=10) + for frame, filename, lineno, function, context, index in list(reversed(frames))[:-2]: + if "/apps/" in filename: + yield { + "filename": re.sub(".*/apps/", "", filename), + "lineno": lineno, + "function": function, + } + except Exception: + pass def record(): if __debug__: