Co-authored-by: Jack W. <Jack5079@users.noreply.github.com>
This commit is contained in:
May 2023-10-29 01:40:03 +00:00
parent a761e3f470
commit 4882a8b352
2 changed files with 25 additions and 15 deletions

File diff suppressed because one or more lines are too long

View file

@ -15,13 +15,12 @@ export default async function ServeError(
reason: string reason: string
) { ) {
// fetch error page if not cached // fetch error page if not cached
if (!errorPage) { errorPage ??= (
errorPage = (
(await readFile(`${process.cwd()}/dist/error.html`).catch((err) => (await readFile(`${process.cwd()}/dist/error.html`).catch((err) =>
console.error(err) console.error(err)
)) || "<pre>$code $text</pre>" )) ?? "<pre>$code $text</pre>"
).toString() ).toString()
}
// serve error // serve error
return ctx.html( return ctx.html(