mirror of
https://github.com/calli-eve/eve-pi.git
synced 2026-02-15 20:19:51 +01:00
add sentry to get fronted error logging
This commit is contained in:
17
src/pages/_error.jsx
Normal file
17
src/pages/_error.jsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
import Error from "next/error";
|
||||
/* eslint-disable react/prop-types */
|
||||
const CustomErrorComponent = (props) => {
|
||||
return <Error statusCode={props.statusCode} />;
|
||||
};
|
||||
|
||||
CustomErrorComponent.getInitialProps = async (contextData) => {
|
||||
// In case this is running in a serverless function, await this in order to give Sentry
|
||||
// time to send the error before the lambda exits
|
||||
await Sentry.captureUnderscoreErrorException(contextData);
|
||||
|
||||
// This will contain the status code of the response
|
||||
return Error.getInitialProps(contextData);
|
||||
};
|
||||
|
||||
export default CustomErrorComponent;
|
||||
Reference in New Issue
Block a user