mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-19 20:16:04 +08:00
updated error handling
This commit is contained in:
parent
3e66bf5757
commit
20e8f68cf8
1 changed files with 2 additions and 11 deletions
|
@ -24,19 +24,10 @@ export async function getDataAndInit() {
|
|||
await DB.initSnapshot();
|
||||
} catch (e) {
|
||||
AccountButton.loading(false);
|
||||
let message = "";
|
||||
|
||||
if (e?.response?.data) {
|
||||
message =
|
||||
"Could not download user data: " +
|
||||
e?.response?.data?.message +
|
||||
" ErrorID: " +
|
||||
e?.response?.data?.errorID;
|
||||
} else {
|
||||
message = "Could not parse user data: " + e.message;
|
||||
}
|
||||
let msg = e?.response?.data?.message ?? e.message;
|
||||
Notifications.add("Failed to get user data: " + msg, -1);
|
||||
|
||||
Notifications.add(message, -1);
|
||||
$("#top #menu .account .icon").html('<i class="fas fa-fw fa-times"></i>');
|
||||
$("#top #menu .account").css("opacity", 1);
|
||||
if ($(".pageLoading").hasClass("active")) UI.changePage("");
|
||||
|
|
Loading…
Add table
Reference in a new issue