From 300a857a5cf9f79eeff31ffb8c87ecc9961260f7 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 24 Mar 2025 17:14:02 +0100 Subject: [PATCH] fix(userStore): simplify error handling on save Replace complex error parsing with direct error message display. This improves code maintainability while still providing useful feedback to users when saving their account data fails. --- frontend/app/mstore/userStore.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/frontend/app/mstore/userStore.ts b/frontend/app/mstore/userStore.ts index 1010b8361..b1ddc8b0f 100644 --- a/frontend/app/mstore/userStore.ts +++ b/frontend/app/mstore/userStore.ts @@ -240,18 +240,7 @@ class UserStore { resolve(response); }) .catch(async (e) => { - const err = await e.response?.json(); - runInAction(() => { - this.saving = false; - }); - const errStr = err.errors[0] - ? err.errors[0].includes('already exists') - ? this.t( - "This email is already linked to an account or team on OpenReplay and can't be used again.", - ) - : err.errors[0] - : this.t('Error saving user'); - toast.error(errStr); + toast.error(e.message || this.t("Failed to save user's data.")); reject(e); }) .finally(() => {