From 8409caef6fd40169c532cae36169f922147b818c Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 20 Feb 2023 18:31:06 +0530 Subject: [PATCH] fix: show proper error with traceback when boot fails --- frappe/exceptions.py | 4 ++++ frappe/public/js/frappe/desk.js | 9 --------- frappe/www/app.py | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/frappe/exceptions.py b/frappe/exceptions.py index f09583e215..20e858c543 100644 --- a/frappe/exceptions.py +++ b/frappe/exceptions.py @@ -244,6 +244,10 @@ class InReadOnlyMode(ValidationError): http_status_code = 503 # temporarily not available +class SessionBootFailed(ValidationError): + http_status_code = 500 + + class TooManyWritesError(Exception): pass diff --git a/frappe/public/js/frappe/desk.js b/frappe/public/js/frappe/desk.js index 4a81e8620b..74e1c4f1e7 100644 --- a/frappe/public/js/frappe/desk.js +++ b/frappe/public/js/frappe/desk.js @@ -34,15 +34,6 @@ frappe.Application = class Application { frappe.socketio.init(); frappe.model.init(); - if (frappe.boot.status === "failed") { - frappe.msgprint({ - message: frappe.boot.error, - title: __("Session Start Failed"), - indicator: "red", - }); - throw "boot failed"; - } - this.load_bootinfo(); this.load_user_permissions(); this.make_nav_bar(); diff --git a/frappe/www/app.py b/frappe/www/app.py index a32fef5748..dcb326af36 100644 --- a/frappe/www/app.py +++ b/frappe/www/app.py @@ -27,8 +27,7 @@ def get_context(context): try: boot = frappe.sessions.get() except Exception as e: - boot = frappe._dict(status="failed", error=str(e)) - print(frappe.get_traceback()) + raise frappe.SessionBootFailed from e # this needs commit csrf_token = frappe.sessions.get_csrf_token()