feat: support custom error pages (#86)

This commit is contained in:
Leo Kettmeir
2022-02-15 01:17:47 +01:00
committed by GitHub
parent 64fbcabf67
commit d334b53320
9 changed files with 243 additions and 26 deletions
+7
View File
@@ -0,0 +1,7 @@
/** @jsx h */
import { h, UnknownPageProps } from "../deps.ts";
export default function NotFoundPage({ url }: UnknownPageProps) {
return <p>404 not found: {url.pathname}</p>;
}
+7
View File
@@ -0,0 +1,7 @@
/** @jsx h */
import { ErrorPageProps, h } from "../deps.ts";
export default function Error500Page({ error }: ErrorPageProps) {
return <p>500 internal error: {(error as Error).message}</p>;
}
+7
View File
@@ -0,0 +1,7 @@
import { HandlerContext } from "../../../server.ts";
export const handler = {
GET(_ctx: HandlerContext) {
throw Error("it errored!");
},
};