Files
sistem-desa-mandiri/src/pages/_error.tsx
bipproduction d401ebb208 fix: add custom Pages Router _error page for 404/500 prerendering
Override default Next.js _error page that imports <Html> from
next/document, which fails during Docker build prerendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:35:48 +08:00

31 lines
751 B
TypeScript

import { NextPageContext } from "next";
function ErrorPage({ statusCode }: { statusCode?: number }) {
return (
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
minHeight: "100vh",
backgroundColor: "#252A2F",
color: "white",
fontFamily: "Lato, sans-serif",
}}
>
<h1 style={{ fontSize: 24, fontWeight: 700 }}>
{statusCode === 404
? "404 - Halaman Tidak Ditemukan"
: "Terjadi Kesalahan"}
</h1>
</div>
);
}
ErrorPage.getInitialProps = ({ res, err }: NextPageContext) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
return { statusCode };
};
export default ErrorPage;