From f6661cbfa0c36a01d3ade3dcdc755faa93e7a979 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 8 Sep 2022 15:54:46 +0530 Subject: [PATCH] fix: respect Accept headers during maintenance mode #18057 (#18063) (cherry picked from commit 022df947112d0e6a017e992d2e0ad84210367ede) Co-authored-by: Ankush Menat --- frappe/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frappe/app.py b/frappe/app.py index 3cf1bf555a..2ba6432a89 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -83,9 +83,6 @@ def application(request: Request): except HTTPException as e: return e - except frappe.SessionStopped as e: - response = frappe.utils.response.handle_session_stopped() - except Exception as e: response = handle_exception(e) @@ -228,6 +225,9 @@ def handle_exception(e): # if the request is ajax, send back the trace or error message response = frappe.utils.response.report_error(http_status_code) + elif isinstance(e, frappe.SessionStopped): + response = frappe.utils.response.handle_session_stopped() + elif ( http_status_code == 500 and (frappe.db and isinstance(e, frappe.db.InternalError))