forked from github/plane
feat: custom error page
This commit is contained in:
parent
2f2caaaf6e
commit
ad60b8774e
@ -35,6 +35,8 @@ const WorkspacePage: NextPage = () => {
|
|||||||
workspaceSlug ? () => userService.userWorkspaceDashboard(workspaceSlug as string) : null
|
workspaceSlug ? () => userService.userWorkspaceDashboard(workspaceSlug as string) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
hi = "hi";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppLayout noHeader={true}>
|
<AppLayout noHeader={true}>
|
||||||
<div className="h-full w-full">
|
<div className="h-full w-full">
|
||||||
|
@ -19,15 +19,32 @@
|
|||||||
import * as Sentry from "@sentry/nextjs";
|
import * as Sentry from "@sentry/nextjs";
|
||||||
import NextErrorComponent from "next/error";
|
import NextErrorComponent from "next/error";
|
||||||
|
|
||||||
const CustomErrorComponent = (props) => <NextErrorComponent statusCode={props.statusCode} />;
|
const CustomErrorComponent = ({ statusCode }) => {
|
||||||
|
console.log(statusCode, "statusCode");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<p>
|
||||||
|
We{"'"}re Sorry! An exception has been detected, and our engineering team has been notified.
|
||||||
|
We apologize for any inconvenience this may have caused. Please reach out to our engineering
|
||||||
|
team at <a href="mailto:support@plane.so">support@plane.so</a> or on our{" "}
|
||||||
|
<a href="https://discord.com/invite/A92xrEGCge" target="_blank" rel="noopener noreferrer">
|
||||||
|
Discord
|
||||||
|
</a>{" "}
|
||||||
|
server for further assistance.
|
||||||
|
</p>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
CustomErrorComponent.getInitialProps = async (contextData) => {
|
CustomErrorComponent.getInitialProps = async (contextData) => {
|
||||||
// In case this is running in a serverless function, await this in order to give Sentry
|
// 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
|
// time to send the error before the lambda exits
|
||||||
await Sentry.captureUnderscoreErrorException(contextData);
|
await Sentry.captureUnderscoreErrorException(contextData);
|
||||||
|
|
||||||
// This will contain the status code of the response
|
const { res, err } = contextData;
|
||||||
return NextErrorComponent.getInitialProps(contextData);
|
|
||||||
|
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
|
||||||
|
|
||||||
|
return { statusCode };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CustomErrorComponent;
|
export default CustomErrorComponent;
|
||||||
|
Loading…
Reference in New Issue
Block a user