Skip to content

Commit 325c2a4

Browse files
committed
fix(ui): show real status code on error page
1 parent 51cb7d2 commit 325c2a4

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

‎apps/dokploy/pages/_error.tsx‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import { buttonVariants } from "@/components/ui/button";
55
import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling";
66

77
interface Props {
8-
statusCode: number;
9-
error?: Error;
8+
statusCode?: number;
109
}
1110

12-
export default function Custom404({ statusCode, error }: Props) {
13-
const displayStatusCode = statusCode || 400;
11+
export default function ErrorPage({ statusCode }: Props) {
12+
const displayStatusCode = statusCode || 500;
1413
const { config: whitelabeling } = useWhitelabelingPublic();
1514
const appName = whitelabeling?.appName || "Dokploy";
1615
const logoUrl = whitelabeling?.logoUrl || undefined;
@@ -45,12 +44,6 @@ export default function Custom404({ statusCode, error }: Props) {
4544
{errorDescription}
4645
</p>
4746
)}
48-
{error && (
49-
<div className="mt-3 text-red-500">
50-
<p>{error.message}</p>
51-
</div>
52-
)}
53-
5447
<div className="mt-5 flex flex-col justify-center items-center gap-2 sm:flex-row sm:gap-3">
5548
<Link
5649
href="/dashboard/home"
@@ -101,8 +94,7 @@ export default function Custom404({ statusCode, error }: Props) {
10194
);
10295
}
10396

104-
// @ts-ignore
105-
Error.getInitialProps = ({ res, err }: NextPageContext) => {
106-
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
107-
return { statusCode, error: err };
97+
ErrorPage.getInitialProps = ({ res, err }: NextPageContext) => {
98+
const statusCode = res ? res.statusCode : err ? (err.statusCode ?? 500) : 404;
99+
return { statusCode };
108100
};

0 commit comments

Comments
 (0)