www: port error pages to Fresh 2 (#2456)
Forgot to port the `_500.tsx` and `_400.tsx` error pages to Fresh 2
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
import { ServerCodePage } from "./_404.tsx";
|
||||
|
||||
export default function InternalServerError() {
|
||||
return ServerCodePage({
|
||||
serverCode: 500,
|
||||
codeDescription: "Oops! Something went wrong.",
|
||||
});
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { HttpError, type PageProps } from "@fresh/core";
|
||||
import LemonDrop from "../islands/LemonDrop.tsx";
|
||||
|
||||
export function ServerCodePage(
|
||||
@@ -27,9 +28,19 @@ export function ServerCodePage(
|
||||
);
|
||||
}
|
||||
|
||||
export default function PageNotFound() {
|
||||
export default function PageNotFound(props: PageProps) {
|
||||
const error = props.error;
|
||||
if (error instanceof HttpError) {
|
||||
if (error.status === 404) {
|
||||
return ServerCodePage({
|
||||
serverCode: 404,
|
||||
codeDescription: "Couldn’t find what you’re looking for.",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return ServerCodePage({
|
||||
serverCode: 404,
|
||||
codeDescription: "Couldn’t find what you’re looking for.",
|
||||
serverCode: 500,
|
||||
codeDescription: "Oops! Something went wrong.",
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user