From e54694dbf42e77fb976eb73c4ce7bdf5a30ebd3b Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Wed, 28 Oct 2020 09:36:39 +0530 Subject: [PATCH] fix(recorder): Error page rendering shouldn't fail when recorder is active --- frappe/recorder.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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__: