From d19a40fc87e7366162d1da3364857da42e656c89 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 8 Jul 2021 16:00:28 +0100 Subject: [PATCH] updated error handling --- src/js/account.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/js/account.js b/src/js/account.js index e636bc4ba..ddea0d7c4 100644 --- a/src/js/account.js +++ b/src/js/account.js @@ -24,13 +24,19 @@ export async function getDataAndInit() { await DB.initSnapshot(); } catch (e) { AccountButton.loading(false); - Notifications.add( - "Could not download user data: " + - e.response.data.message + + let message = ""; + + if (e?.response?.data) { + message = + "Could not download user data: " + + e?.response?.data?.message + " ErrorID: " + - e.response.data.errorID, - -1 - ); + e?.response?.data?.errorID; + } else { + message = "Could not parse user data: " + e.message; + } + + Notifications.add(message, -1); $("#top #menu .account .icon").html(''); $("#top #menu .account").css("opacity", 1); if ($(".pageLoading").hasClass("active")) UI.changePage("");