Skip to content

Commit ae86648

Browse files
committed
fix: migrate error handling from Sentry to Faro in Redux actions
1 parent e8d4453 commit ae86648

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

web/src/redux/actions/contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { faro } from "@grafana/faro-react";
12
import { Action, ThunkAction } from "@reduxjs/toolkit";
2-
import { captureException } from "@sentry/react";
33
import { contributionPageSlice } from "src/redux/slices/contribution-page";
44
import { AppState } from "src/redux/store";
55
import { fetchV2 } from "src/utils/fetch";
@@ -17,6 +17,6 @@ export const fetchContributionAction =
1717
dispatch(contributionPageSlice.actions.set({ contribution }));
1818
} catch (error) {
1919
dispatch(contributionPageSlice.actions.set({ contribution: "ERROR" }));
20-
captureException(error, { tags: { type: "WEB_FETCH" } });
20+
faro.api.pushError(error as Error, { type: "WEB_FETCH" });
2121
}
2222
};

web/src/redux/actions/contributions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { faro } from "@grafana/faro-react";
12
import { Action, ThunkAction } from "@reduxjs/toolkit";
2-
import { captureException } from "@sentry/react";
33
import { contributionsPageSlice } from "src/redux/slices/contributions-page";
44
import { AppState } from "src/redux/store";
55
import { fetchV2 } from "src/utils/fetch";
@@ -13,6 +13,6 @@ export const fetchContributionsListAction =
1313
dispatch(contributionsPageSlice.actions.set({ contributionsList: contributions }));
1414
} catch (error) {
1515
dispatch(contributionsPageSlice.actions.set({ contributionsList: "ERROR" }));
16-
captureException(error, { tags: { type: "WEB_FETCH" } });
16+
faro.api.pushError(error as Error, { type: "WEB_FETCH" });
1717
}
1818
};

web/src/redux/actions/contributor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { faro } from "@grafana/faro-react";
12
import { Action, ThunkAction } from "@reduxjs/toolkit";
2-
import { captureException } from "@sentry/react";
33
import { contributorPageSlice } from "src/redux/slices/contributor-page";
44
import { AppState } from "src/redux/store";
55
import { fetchV2 } from "src/utils/fetch";
@@ -17,6 +17,6 @@ export const fetchContributorAction =
1717
dispatch(contributorPageSlice.actions.set({ contributor }));
1818
} catch (error) {
1919
dispatch(contributorPageSlice.actions.set({ contributor: "ERROR" }));
20-
captureException(error, { tags: { type: "WEB_FETCH" } });
20+
faro.api.pushError(error as Error, { type: "WEB_FETCH" });
2121
}
2222
};

web/src/redux/actions/contributors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { faro } from "@grafana/faro-react";
12
import { Action, ThunkAction } from "@reduxjs/toolkit";
2-
import { captureException } from "@sentry/react";
33
import { contributorsPageSlice } from "src/redux/slices/contributors-page";
44
import { AppState } from "src/redux/store";
55
import { fetchV2 } from "src/utils/fetch";
@@ -12,6 +12,6 @@ export const fetchContributorsListAction =
1212
dispatch(contributorsPageSlice.actions.set({ contributorsList: contributors }));
1313
} catch (error) {
1414
dispatch(contributorsPageSlice.actions.set({ contributorsList: "ERROR" }));
15-
captureException(error, { tags: { type: "WEB_FETCH" } });
15+
faro.api.pushError(error as Error, { type: "WEB_FETCH" });
1616
}
1717
};

web/src/redux/actions/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { faro } from "@grafana/faro-react";
12
import { Action, ThunkAction } from "@reduxjs/toolkit";
2-
import { captureException } from "@sentry/react";
33
import { projectPageSlice } from "src/redux/slices/project-page";
44
import { AppState } from "src/redux/store";
55
import { fetchV2 } from "src/utils/fetch";
@@ -17,6 +17,6 @@ export const fetchProjectAction =
1717
dispatch(projectPageSlice.actions.set({ project }));
1818
} catch (error) {
1919
dispatch(projectPageSlice.actions.set({ project: "ERROR" }));
20-
captureException(error, { tags: { type: "WEB_FETCH" } });
20+
faro.api.pushError(error as Error, { type: "WEB_FETCH" });
2121
}
2222
};

web/src/redux/actions/projects.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { faro } from "@grafana/faro-react";
12
import { Action, ThunkAction } from "@reduxjs/toolkit";
2-
import { captureException } from "@sentry/react";
33
import { projectsPageSlice } from "src/redux/slices/projects-page";
44
import { AppState } from "src/redux/store";
55
import { fetchV2 } from "src/utils/fetch";
@@ -12,6 +12,6 @@ export const fetchProjectsListAction =
1212
dispatch(projectsPageSlice.actions.set({ projectsList: projects }));
1313
} catch (error) {
1414
dispatch(projectsPageSlice.actions.set({ projectsList: "ERROR" }));
15-
captureException(error, { tags: { type: "WEB_FETCH" } });
15+
faro.api.pushError(error as Error, { type: "WEB_FETCH" });
1616
}
1717
};

web/src/redux/actions/settings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { DEFAULT_LANGUAGE, LANGUAGES } from "@dzcode.io/models/dist/language";
22
import { LanguageCode } from "@dzcode.io/utils/dist/language";
3-
import { captureException } from "@sentry/react";
3+
import { faro } from "@grafana/faro-react";
44

55
export const changeLanguage = (languageCode: LanguageCode) => {
66
let newPath = window.location.pathname;
77
const language = LANGUAGES.find(({ code }) => code === languageCode);
88
if (!language) {
9-
console.error("Invalid language code", languageCode);
10-
captureException(`Invalid language code ${language}`, { tags: { type: "GENERIC" } });
9+
const error = new Error(`Invalid language code ${languageCode}`);
10+
faro.api.pushError(error);
1111
return;
1212
}
1313

0 commit comments

Comments
 (0)