From 378e160283d9e277f30acb36cfbcfdd9feb78d39 Mon Sep 17 00:00:00 2001 From: spsjvc Date: Tue, 16 Jul 2024 16:55:01 +0200 Subject: [PATCH] fix: check if error exists (#1759) --- .../TransactionHistory/TransactionsTableRowAction.tsx | 2 +- packages/arb-token-bridge-ui/src/util/isUserRejectedError.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx index 96c157f13d..26ff04e019 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/TransactionsTableRowAction.tsx @@ -96,7 +96,7 @@ export function TransactionsTableRowAction({ } errorToast( - `Can't claim ${type === 'deposits' ? 'withdrawal' : 'deposit'}: ${ + `Can't claim ${type === 'deposits' ? 'deposit' : 'withdrawal'}: ${ error?.message ?? error }` ) diff --git a/packages/arb-token-bridge-ui/src/util/isUserRejectedError.ts b/packages/arb-token-bridge-ui/src/util/isUserRejectedError.ts index 3b21d1ab23..8aead3d54b 100644 --- a/packages/arb-token-bridge-ui/src/util/isUserRejectedError.ts +++ b/packages/arb-token-bridge-ui/src/util/isUserRejectedError.ts @@ -10,8 +10,8 @@ function isUserRejectedError(error: any) { return ( error?.code === 4001 || error?.code === 'ACTION_REJECTED' || - error instanceof UserRejectedRequestError || - error.message.match(/User Cancelled/) + error?.message.match(/User Cancelled/) || + error instanceof UserRejectedRequestError ) } export { isUserRejectedError }