From ad328542da55315199cd881aad25991bfede3233 Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Mon, 5 Feb 2024 13:58:11 +0100 Subject: [PATCH] fix(analytics): reporting empty error, closes #4907 --- .../transaction/use-bitcoin-broadcast-transaction.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/query/bitcoin/transaction/use-bitcoin-broadcast-transaction.ts b/src/app/query/bitcoin/transaction/use-bitcoin-broadcast-transaction.ts index 84065d865c5..298a6643721 100644 --- a/src/app/query/bitcoin/transaction/use-bitcoin-broadcast-transaction.ts +++ b/src/app/query/bitcoin/transaction/use-bitcoin-broadcast-transaction.ts @@ -1,5 +1,7 @@ import { useCallback, useState } from 'react'; +import { isError } from '@shared/utils'; + import { useAnalytics } from '@app/common/hooks/analytics/use-analytics'; import { delay } from '@app/common/utils'; import { useBitcoinClient } from '@app/store/common/api-clients.hooks'; @@ -30,7 +32,10 @@ export function useBitcoinBroadcastTransaction() { return txid; } catch (e) { onError?.(e as Error); - void analytics.track('error_broadcasting_transaction', { error: e }); + void analytics.track('error_broadcasting_transaction', { + errorName: isError(e) ? e.name : 'unknown', + errorMsg: isError(e) ? e.message : 'unknown', + }); return; } finally { setIsBroadcasting(false);