ref: refactorise la configuration du SDK Sentry
This commit is contained in:
parent
eb7e1ec69f
commit
80a992a583
4 changed files with 17 additions and 16 deletions
|
|
@ -1 +1 @@
|
||||||
{ "dictionaries": ["fr-fr", "en-gb"], "words": ["oxlint", "Vali", "mobily", "valibot"] }
|
{ "dictionaries": ["fr-fr", "en-gb"], "words": ["oxlint", "Vali", "mobily", "valibot", "GLITCHTIP"] }
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
- MÉTHODES DE LIVRAISON
|
- MÉTHODES DE LIVRAISON
|
||||||
- [ ] Proposer la livraison à domicile en Belgique et en France pour le coût unique de 8 euros, quel que soit le montant de la commande
|
- [ ] Proposer la livraison à domicile en Belgique et en France pour le coût unique de 8 euros, quel que soit le montant de la commande
|
||||||
- PAGE PRODUIT
|
- PAGE PRODUIT
|
||||||
- Corriger la grille des détails pour les Produits Simples.
|
|
||||||
- PIED DE PAGE
|
- PIED DE PAGE
|
||||||
- Réduire la hauteur.
|
- Réduire la hauteur.
|
||||||
- TOUTES LES PAGES
|
- TOUTES LES PAGES
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import type { Transport, TransportMakeRequestResponse, TransportRequest } from "
|
||||||
import { pipe } from "@mobily/ts-belt";
|
import { pipe } from "@mobily/ts-belt";
|
||||||
import {
|
import {
|
||||||
breadcrumbsIntegration,
|
breadcrumbsIntegration,
|
||||||
|
browserApiErrorsIntegration,
|
||||||
BrowserClient,
|
BrowserClient,
|
||||||
captureConsoleIntegration,
|
captureConsoleIntegration,
|
||||||
createTransport,
|
|
||||||
dedupeIntegration,
|
dedupeIntegration,
|
||||||
defaultStackParser,
|
defaultStackParser,
|
||||||
functionToStringIntegration,
|
functionToStringIntegration,
|
||||||
|
|
@ -19,13 +19,12 @@ import {
|
||||||
httpContextIntegration,
|
httpContextIntegration,
|
||||||
linkedErrorsIntegration,
|
linkedErrorsIntegration,
|
||||||
} from "@sentry/browser";
|
} from "@sentry/browser";
|
||||||
|
import { createTransport } from "@sentry/core";
|
||||||
import type { BrowserTransportOptions } from "./lib/types/sentry";
|
|
||||||
|
|
||||||
import { ENTETE_GLITCHTIP_RATE_LIMITS, ENTETE_GLITCHTIP_RETRY_AFTER } from "./constantes/api";
|
import { ENTETE_GLITCHTIP_RATE_LIMITS, ENTETE_GLITCHTIP_RETRY_AFTER } from "./constantes/api";
|
||||||
|
|
||||||
/* Créé la fonction génératrice de la requête auprès de GlitchTip */
|
/* Créé la fonction génératrice de la requête auprès de GlitchTip */
|
||||||
const creeTransportFetch = (options: BrowserTransportOptions): Transport => {
|
const creeTransportFetch = (options): Transport => {
|
||||||
const creeRequete = async (requete: TransportRequest): Promise<TransportMakeRequestResponse> => {
|
const creeRequete = async (requete: TransportRequest): Promise<TransportMakeRequestResponse> => {
|
||||||
const optionsRequete: RequestInit = {
|
const optionsRequete: RequestInit = {
|
||||||
body: requete.body,
|
body: requete.body,
|
||||||
|
|
@ -56,13 +55,25 @@ const client = new BrowserClient({
|
||||||
dsn: import.meta.env.VITE_GLITCHTIP_NSD,
|
dsn: import.meta.env.VITE_GLITCHTIP_NSD,
|
||||||
environment: import.meta.env.VITE_MODE,
|
environment: import.meta.env.VITE_MODE,
|
||||||
integrations: [
|
integrations: [
|
||||||
|
// Wraps native browser APIs to capture breadcrumbs.
|
||||||
breadcrumbsIntegration(),
|
breadcrumbsIntegration(),
|
||||||
|
// Wraps native time and events APIs in `try/catch` blocks to handle async exceptions
|
||||||
|
browserApiErrorsIntegration(),
|
||||||
|
// Captures all Console API calls via `captureException` or `captureMessage`.
|
||||||
captureConsoleIntegration({ levels: ["warn", "error"] }),
|
captureConsoleIntegration({ levels: ["warn", "error"] }),
|
||||||
|
// Deduplicate certain events to avoid receiving duplicate errors.
|
||||||
dedupeIntegration(),
|
dedupeIntegration(),
|
||||||
|
// Allows the SDK to provide original functions and method names, even when those functions or methods are wrapped by our error or breadcrumb handlers.
|
||||||
functionToStringIntegration(),
|
functionToStringIntegration(),
|
||||||
|
// Attaches global handlers to capture uncaught exceptions and unhandled rejections.
|
||||||
globalHandlersIntegration(),
|
globalHandlersIntegration(),
|
||||||
httpClientIntegration(),
|
// Captures errors on failed requests from Fetch and XHR and attaches request and response information.
|
||||||
|
httpClientIntegration({
|
||||||
|
failedRequestStatusCodes: [[400, 599]],
|
||||||
|
}),
|
||||||
|
// Attaches HTTP request information, such as URL, user-agent, referrer, and other headers to the event.
|
||||||
httpContextIntegration(),
|
httpContextIntegration(),
|
||||||
|
// Allows you to configure linked errors.
|
||||||
linkedErrorsIntegration(),
|
linkedErrorsIntegration(),
|
||||||
],
|
],
|
||||||
sendDefaultPii: true,
|
sendDefaultPii: true,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
import type { BaseTransportOptions } from "@sentry/types";
|
|
||||||
|
|
||||||
/* Recréé une Interface non exposé par Sentry */
|
|
||||||
export interface BrowserTransportOptions extends BaseTransportOptions {
|
|
||||||
/** Fetch API init parameters. Used by the FetchTransport */
|
|
||||||
fetchOptions?: RequestInit;
|
|
||||||
/** Custom headers for the transport. Used by the XHRTransport and FetchTransport */
|
|
||||||
headers?: Record<string, string>;
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue