History

Merge pull request #4954 from Dokploy/fix/error-page-status-code

fix(ui): show real status code on error page

Mauricio Siu committed 3 months ago

Commit 3835a6f2 parents 51cb7d2 325c2a41 file · +6 −14Browse files

Unified · Split

apps/dokploy/pages/_error.tsx+6−14
@@ -5,12 +5,11 @@ import { buttonVariants } from "@/components/ui/button"; · 4 unmodified lines
5import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling";5import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling";
6 6
7interface Props {7interface Props {
8 statusCode: number;8 statusCode?: number;
9 error?: Error;
10}9}
11 10
12export default function Custom404({ statusCode, error }: Props) {11export default function ErrorPage({ statusCode }: Props) {
13 const displayStatusCode = statusCode || 400;12 const displayStatusCode = statusCode || 500;
14 const { config: whitelabeling } = useWhitelabelingPublic();13 const { config: whitelabeling } = useWhitelabelingPublic();
15 const appName = whitelabeling?.appName || "Dokploy";14 const appName = whitelabeling?.appName || "Dokploy";
16 const logoUrl = whitelabeling?.logoUrl || undefined;15 const logoUrl = whitelabeling?.logoUrl || undefined;
@@ -45,12 +44,6 @@ export default function Custom404({ statusCode, error }: Props) { · 28 unmodified lines
45 {errorDescription}44 {errorDescription}
46 </p>45 </p>
47 )}46 )}
48 {error && (
49 <div className="mt-3 text-red-500">
50 <p>{error.message}</p>
51 </div>
52 )}
53
54 <div className="mt-5 flex flex-col justify-center items-center gap-2 sm:flex-row sm:gap-3">47 <div className="mt-5 flex flex-col justify-center items-center gap-2 sm:flex-row sm:gap-3">
55 <Link48 <Link
56 href="/dashboard/home"49 href="/dashboard/home"
@@ -101,8 +94,7 @@ export default function Custom404({ statusCode, error }: Props) { · 44 unmodified lines
101 );94 );
102}95}
103 96
104// @ts-ignore97ErrorPage.getInitialProps = ({ res, err }: NextPageContext) => {
105Error.getInitialProps = ({ res, err }: NextPageContext) => {98 const statusCode = res ? res.statusCode : err ? (err.statusCode ?? 500) : 404;
106 const statusCode = res ? res.statusCode : err ? err.statusCode : 404;99 return { statusCode };
107 return { statusCode, error: err };
108};100};