Skip to content

Commit

Permalink
Only log relevant errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodyowl committed Apr 17, 2024
1 parent b85587a commit a1a2c8d
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 9 deletions.
2 changes: 0 additions & 2 deletions clients/banking/src/components/NavigationTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { StyleSheet, View } from "react-native";
import { P, match } from "ts-pattern";
import { AccountAreaQuery, IdentificationLevelFragment } from "../graphql/partner";
import { t } from "../utils/i18n";
import { logFrontendError } from "../utils/logger";
import { Router, accountAreaRoutes } from "../utils/routes";
import { AccountNavigation, Menu } from "./AccountNavigation";
import { AccountActivationTag, AccountPicker, AccountPickerButton } from "./AccountPicker";
Expand Down Expand Up @@ -173,7 +172,6 @@ export const NavigationTabBar = ({
.tapOk(() => window.location.replace(Router.ProjectLogin()))
.tapError(error => {
showToast({ variant: "error", error, title: translateError(error) });
logFrontendError(error);
});
};

Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const initSentry = () => {
});
};

export const logFrontendError = (exception: unknown, extra?: Record<string, unknown>) => {
export const logFrontendError = (exception: Error, extra?: Record<string, unknown>) => {
captureException(exception, {
extra,
tags: { scope: "frontend" },
Expand Down
2 changes: 0 additions & 2 deletions clients/banking/src/utils/signout.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { showToast } from "@swan-io/lake/src/state/toasts";
import { Request, badStatusToError } from "@swan-io/request";
import { translateError } from "@swan-io/shared-business/src/utils/i18n";
import { logFrontendError } from "./logger";
import { Router } from "./routes";

export const signout = () => {
Expand All @@ -10,6 +9,5 @@ export const signout = () => {
.tapOk(() => window.location.replace(Router.ProjectLogin()))
.tapError(error => {
showToast({ variant: "error", error, title: translateError(error) });
logFrontendError(error);
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import {
import { CompanySuggestion } from "../../utils/Pappers";
import { env } from "../../utils/env";
import { locale, t } from "../../utils/i18n";
import { logFrontendError } from "../../utils/logger";
import { CompanyOnboardingRoute, Router } from "../../utils/routes";
import {
getRegistrationNumberName,
Expand Down Expand Up @@ -397,7 +396,7 @@ export const OnboardingCompanyOrganisation1 = ({
error={error}
onValueChange={onChange}
onSuggestion={onSelectCompany}
onLoadError={logFrontendError}
onLoadError={noop}
/>
) : (
<LakeTextInput
Expand Down
2 changes: 1 addition & 1 deletion clients/onboarding/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const initSentry = () => {
});
};

export const logFrontendError = (exception: unknown, extra?: Record<string, unknown>) => {
export const logFrontendError = (exception: Error, extra?: Record<string, unknown>) => {
captureException(exception, {
extra,
tags: { scope: "frontend" },
Expand Down
2 changes: 1 addition & 1 deletion clients/payment/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const initSentry = () => {
});
};

export const logFrontendError = (exception: unknown, extra?: Record<string, unknown>) => {
export const logFrontendError = (exception: Error, extra?: Record<string, unknown>) => {
captureException(exception, {
extra,
tags: { scope: "frontend" },
Expand Down

0 comments on commit a1a2c8d

Please sign in to comment.