Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: track parse errors #1366

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export const AnalyticsEvents = unionize(
assetSymbol?: string;
assetName?: string;
}>(),
WebsocketParseError: ofType<{ message: string }>(),

// vaults
ClickViewVaultFromPositionCard: ofType<{}>(),
Expand Down
7 changes: 6 additions & 1 deletion src/lib/abacus/stateNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {
} from '@/constants/abacus';
import { Changes } from '@/constants/abacus';
import { NUM_PARENT_SUBACCOUNTS } from '@/constants/account';
import { AnalyticsEvents } from '@/constants/analytics';
import { timeUnits } from '@/constants/time';

import { type RootStore } from '@/state/_store';
Expand Down Expand Up @@ -44,6 +45,7 @@ import { setLatestOrder, updateFilledOrders, updateOrders } from '@/state/localO
import { updateNotifications } from '@/state/notifications';
import { setHistoricalFundings, setLiveTrades, setMarkets, setOrderbook } from '@/state/perpetuals';

import { track } from '../analytics/analytics';
import { isTruthy } from '../isTruthy';

class AbacusStateNotifier implements AbacusStateNotificationProtocol {
Expand Down Expand Up @@ -267,8 +269,11 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
}

errorsEmitted(errors: ParsingErrors) {
const arr = errors.toArray();

track(AnalyticsEvents.WebsocketParseError({ message: arr.map((a) => a.message).join(', ') }));
// eslint-disable-next-line no-console
console.error('parse errors', errors.toArray());
console.error('parse errors', arr);
}

apiStateChanged(apiState: AbacusApiState) {
Expand Down
Loading