From 073c5379d398b4cd36d3a71d20bf9e268813636e Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 28 May 2020 09:44:39 +0000 Subject: [PATCH] refactor: handle exception in syncing dashboard (#10522) (cherry picked from commit e222961b3385cb3d44f84d38b2b325c75b869bcc) --- frappe/utils/dashboard.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frappe/utils/dashboard.py b/frappe/utils/dashboard.py index f06f9272b8..c1884d62fb 100644 --- a/frappe/utils/dashboard.py +++ b/frappe/utils/dashboard.py @@ -89,10 +89,14 @@ def sync_dashboards(app=None): config = get_config(app_name, module_name) if config: frappe.flags.in_import = True - make_records(config.charts, "Dashboard Chart") - make_records(config.number_cards, "Number Card") - make_records(config.dashboards, "Dashboard") - frappe.flags.in_import = False + try: + make_records(config.charts, "Dashboard Chart") + make_records(config.number_cards, "Number Card") + make_records(config.dashboards, "Dashboard") + except Exception as e: + frappe.log_error(e, _("Dashboard Import Error")) + finally: + frappe.flags.in_import = False def make_records(config, doctype): if not config: