From 419be4584fef6ef1411bd9630d20a3bfaffcbdde Mon Sep 17 00:00:00 2001 From: Ritika-Patel08 Date: Wed, 7 Feb 2024 14:50:32 +0530 Subject: [PATCH] Fixed: error handling in login process in case of object in error (dxp-258) --- src/store/modules/user/actions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index b632bfde..72e232a9 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -96,8 +96,7 @@ const actions: ActionTree = { // TODO Check if handling of specific status codes is required. showToast(translate('Something went wrong while login. Please contact administrator')); console.error("error", err); - // Added ternary check for serverResponse as in to correctly display the message on UI, need to remove this once all the service reject in same format - return Promise.reject(new Error(err?.serverResponse ? err.serverResponse : err)) + return Promise.reject(err instanceof Object ? err : new Error(err)); } },