From 300be15d3fdcdc9297a7b28427cfcdc905991306 Mon Sep 17 00:00:00 2001 From: Francisco Ramos Date: Mon, 12 Jun 2023 13:58:47 +0200 Subject: [PATCH] fix(bridge-ui): filtering out BLL token failure when bridging (#13969) --- .../components/BridgeForm/BridgeForm.svelte | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte b/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte index f92019b04e9..5ac61de51c9 100644 --- a/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte +++ b/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte @@ -237,16 +237,12 @@ // title (header), note (footer), icon, etc. const headerError = 'Failed to approve
'; - const noteError = - _token.symbol.toLocaleLowerCase() === 'bll' - ? '
Note: BLL token intentionally will fail 50% of the time
' - : ''; if (error.cause?.status === 0) { const explorerUrl = `${$srcChain.explorerUrl}/tx/${error.cause.transactionHash}`; const htmlLink = `here`; errorToast( - `${headerError}Click ${htmlLink} to see more details on the explorer.${noteError}`, + `${headerError}Click ${htmlLink} to see more details on the explorer.`, true, // dismissible ); } else if ( @@ -254,7 +250,7 @@ ) { warningToast(`Transaction has been rejected.`); } else { - errorToast(`${headerError}Try again later.${noteError}`); + errorToast(`${headerError}Try again later.`); } } } @@ -425,15 +421,19 @@ ); } catch (error) { console.error(error); - Sentry.captureException(error); + + const isBll = _token.symbol.toLocaleLowerCase() === 'bll'; const headerError = 'Failed to bridge funds
'; - const noteError = - _token.symbol.toLocaleLowerCase() === 'bll' - ? '
Note: BLL token intentionally will fail 50% of the time
' - : ''; + const noteError = isBll + ? '
Note: BLL token intentionally will fail 50% of the time
' + : ''; if (error.cause?.status === 0) { + // No need to capture this error if BLL is the one failing, + // otherwise we're gonna spam Sentry with expected errors + !isBll && Sentry.captureException(error); + const explorerUrl = `${$srcChain.explorerUrl}/tx/${error.cause.transactionHash}`; const htmlLink = `here`; errorToast( @@ -445,6 +445,9 @@ ) { warningToast(`Transaction has been rejected.`); } else { + // Do not capture if it's BLL. It's expected. + !isBll && Sentry.captureException(error); + errorToast(`${headerError}Try again later.${noteError}`); } }