feat: support custom error pages (#86)
This commit is contained in:
@@ -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>;
|
||||
}
|
||||
@@ -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>;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { HandlerContext } from "../../../server.ts";
|
||||
|
||||
export const handler = {
|
||||
GET(_ctx: HandlerContext) {
|
||||
throw Error("it errored!");
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user