Merge pull request #10523 from frappe/mergify/bp/develop/pr-10522

refactor: handle exception in syncing dashboard (bp #10522)
This commit is contained in:
sahil28297 2020-05-28 18:43:50 +05:30 committed by GitHub
commit 04c9f58e02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: