From 9ebd548643c177f8d01f5f0a49ea93aad2a7183e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Brzezin=CC=81ski?= Date: Mon, 19 Aug 2024 14:29:00 +0200 Subject: [PATCH] analitics sending fixes --- components/swap/SwapReviewRouteInfo.tsx | 6 +++--- components/swap/SwapTriggerOrders.tsx | 8 ++++---- components/trade/AdvancedTradeForm.tsx | 2 +- components/trade/SpotMarketOrderSwapForm.tsx | 2 +- utils/notifications.ts | 4 ++-- utils/tradeForm.ts | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/components/swap/SwapReviewRouteInfo.tsx b/components/swap/SwapReviewRouteInfo.tsx index 7a6b2762..450e982c 100644 --- a/components/swap/SwapReviewRouteInfo.tsx +++ b/components/swap/SwapReviewRouteInfo.tsx @@ -428,7 +428,7 @@ const SwapReviewRouteInfo = ({ }) actions.fetchWalletTokens(wallet.publicKey) } catch (e) { - sentry.captureException({ e, txid, origin: selectedRoute.origin }) + sentry.captureException(`${{ e, txid, origin: selectedRoute.origin }}`) console.log('error swapping wallet tokens', e) } finally { setSubmitting(false) @@ -543,7 +543,7 @@ const SwapReviewRouteInfo = ({ 'onSwapError', ) console.error('onSwap error: ', e) - sentry.captureException({ e, tx, origin: selectedRoute.origin }) + sentry.captureException(`${{ e, tx, origin: selectedRoute.origin }}`) if (isMangoError(e)) { const slippageExceeded = await parseTxForKnownErrors( connection, @@ -602,7 +602,7 @@ const SwapReviewRouteInfo = ({ setSubmitting(false) } } catch (e) { - sentry.captureException({ e, origin: selectedRoute.origin }) + sentry.captureException(`${{ e, origin: selectedRoute.origin }}`) console.error('Swap error:', e) } finally { if (!directRouteFallbackUsed) { diff --git a/components/swap/SwapTriggerOrders.tsx b/components/swap/SwapTriggerOrders.tsx index 07ef666f..cbeddc11 100644 --- a/components/swap/SwapTriggerOrders.tsx +++ b/components/swap/SwapTriggerOrders.tsx @@ -65,7 +65,7 @@ export const handleCancelTriggerOrder = async ( await actions.reloadMangoAccount(slot) } catch (e) { console.error('failed to cancel swap order', e) - sentry.captureException({ e, txid }) + sentry.captureException(`${{ e, txid }}`) if (isMangoError(e)) { notify({ title: 'Transaction failed', @@ -77,7 +77,7 @@ export const handleCancelTriggerOrder = async ( } } } catch (e) { - sentry.captureException({ e }) + sentry.captureException(`${{ e }}`) console.error('failed to cancel trigger order', e) } finally { if (setCancelId) { @@ -112,7 +112,7 @@ export const handleCancelAll = async ( await actions.reloadMangoAccount(slot) } catch (e) { console.error('failed to cancel trigger orders', e) - sentry.captureException({ e, txid }) + sentry.captureException(`${{ e, txid }}`) if (isMangoError(e)) { notify({ title: 'Transaction failed', @@ -124,7 +124,7 @@ export const handleCancelAll = async ( } } } catch (e) { - sentry.captureException({ e }) + sentry.captureException(`${{ e }}`) console.error('failed to cancel swap order', e) } finally { setCancelId('') diff --git a/components/trade/AdvancedTradeForm.tsx b/components/trade/AdvancedTradeForm.tsx index 54647dd3..650946cc 100644 --- a/components/trade/AdvancedTradeForm.tsx +++ b/components/trade/AdvancedTradeForm.tsx @@ -800,7 +800,7 @@ const AdvancedTradeForm = () => { } } catch (e) { console.error('Place trade error:', e) - sentry.captureException({ e, txid }) + sentry.captureException(`${{ e, txid }}`) if (!isMangoError(e)) return notify({ title: 'There was an issue.', diff --git a/components/trade/SpotMarketOrderSwapForm.tsx b/components/trade/SpotMarketOrderSwapForm.tsx index 951ddafb..7b2df757 100644 --- a/components/trade/SpotMarketOrderSwapForm.tsx +++ b/components/trade/SpotMarketOrderSwapForm.tsx @@ -318,7 +318,7 @@ export default function SpotMarketOrderSwapForm() { }) } catch (e) { console.error('onSwap error: ', e) - sentry.captureException({ e, txid }) + sentry.captureException(`${{ e, txid }}`) if (isMangoError(e)) { const slippageExceeded = await parseTxForKnownErrors( connection, diff --git a/utils/notifications.ts b/utils/notifications.ts index 732c4481..887a4834 100644 --- a/utils/notifications.ts +++ b/utils/notifications.ts @@ -51,11 +51,11 @@ export function notify(newNotification: { : INITIAL_SOUND_SETTINGS if (newNotification.type === 'error' && !newNotification.noSentry) { sentry.captureException( - { + `${{ title: newNotification.title, description: newNotification.description, txid: newNotification.txid, - }, + }}`, { tags: { origin: 'userAlert', diff --git a/utils/tradeForm.ts b/utils/tradeForm.ts index 98343dd7..8dbbe116 100644 --- a/utils/tradeForm.ts +++ b/utils/tradeForm.ts @@ -182,7 +182,7 @@ export const handlePlaceTriggerOrder = async ( await actions.reloadMangoAccount(tx?.slot) } catch (e) { console.error('onSwap error: ', e) - sentry.captureException(e) + sentry.captureException(`${e}`) if (isMangoError(e)) { notify({ title: 'Transaction failed',