From 4d160052b44587e60aab1281a000376d1e1e4c4f Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Mon, 12 Mar 2018 22:58:16 +0530 Subject: [PATCH 1/2] Check if server is alive and let socket.io then request --- frappe/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/app.py b/frappe/app.py index 83efb7de34..638c16eadf 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -143,7 +143,7 @@ def handle_exception(e): http_status_code = getattr(e, "http_status_code", 500) return_as_message = False - if frappe.local.is_ajax or 'application/json' in frappe.get_request_header('Accept'): + if frappe.get_request_header('Accept') and frappe.local.is_ajax or 'application/json' in frappe.get_request_header('Accept'): # handle ajax responses first # if the request is ajax, send back the trace or error message response = frappe.utils.response.report_error(http_status_code) From 0f3b717447c71dbb59063302e9b9f632f1c4291f Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Mon, 12 Mar 2018 22:59:23 +0530 Subject: [PATCH 2/2] conditional checks --- frappe/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/app.py b/frappe/app.py index 638c16eadf..ea346a0417 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -143,7 +143,7 @@ def handle_exception(e): http_status_code = getattr(e, "http_status_code", 500) return_as_message = False - if frappe.get_request_header('Accept') and frappe.local.is_ajax or 'application/json' in frappe.get_request_header('Accept'): + if frappe.get_request_header('Accept') and (frappe.local.is_ajax or 'application/json' in frappe.get_request_header('Accept')): # handle ajax responses first # if the request is ajax, send back the trace or error message response = frappe.utils.response.report_error(http_status_code)