* custom error component
* upload sourcemaps to sentry * report caught errors to sentry
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
import { Head, ErrorComponent } from "blitz";
|
||||
import { Head } from "blitz";
|
||||
|
||||
import ErrorComponent from "../core/components/error-component";
|
||||
|
||||
// ------------------------------------------------------
|
||||
// This page is rendered if a route match is not found
|
||||
|
@ -1,15 +1,17 @@
|
||||
import { Suspense } from "react";
|
||||
import { Suspense, useEffect } from "react";
|
||||
import {
|
||||
AppProps,
|
||||
ErrorBoundary,
|
||||
ErrorComponent,
|
||||
AuthenticationError,
|
||||
AuthorizationError,
|
||||
ErrorFallbackProps,
|
||||
useQueryErrorResetBoundary,
|
||||
getConfig,
|
||||
useSession,
|
||||
} from "blitz";
|
||||
|
||||
import Sentry from "../../integrations/sentry";
|
||||
import ErrorComponent from "../core/components/error-component";
|
||||
import LoginForm from "../auth/components/login-form";
|
||||
import { usePanelbear } from "../core/hooks/use-panelbear";
|
||||
|
||||
@ -18,12 +20,27 @@ import "app/core/styles/index.css";
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
const session = useSession();
|
||||
usePanelbear(publicRuntimeConfig.panelBear.siteId);
|
||||
useEffect(() => {
|
||||
if (session.userId) {
|
||||
Sentry.setUser({
|
||||
id: session.userId.toString(),
|
||||
orgId: session.orgId,
|
||||
});
|
||||
}
|
||||
}, [session]);
|
||||
|
||||
const getLayout = Component.getLayout || ((page) => page);
|
||||
|
||||
return (
|
||||
<ErrorBoundary FallbackComponent={RootErrorFallback} onReset={useQueryErrorResetBoundary().reset}>
|
||||
<ErrorBoundary
|
||||
onError={(error, componentStack) =>
|
||||
Sentry.captureException(error, { contexts: { react: { componentStack } } })
|
||||
}
|
||||
FallbackComponent={RootErrorFallback}
|
||||
onReset={useQueryErrorResetBoundary().reset}
|
||||
>
|
||||
<Suspense fallback="Silence, ca pousse">{getLayout(<Component {...pageProps} />)}</Suspense>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
|
1
app/pages/_error.tsx
Normal file
1
app/pages/_error.tsx
Normal file
@ -0,0 +1 @@
|
||||
export { default } from "../core/components/error-component";
|
Reference in New Issue
Block a user