fix(core): error 500 when no 404.html is found
This commit is contained in:
parent
3ea1ed8bff
commit
9c2e0cfed6
1 changed files with 15 additions and 8 deletions
|
@ -10,20 +10,27 @@ export function defineRoute({ config, storage }) {
|
||||||
const { components: componentType } = config();
|
const { components: componentType } = config();
|
||||||
let html = await getHtml(path, storage);
|
let html = await getHtml(path, storage);
|
||||||
|
|
||||||
const transforms = [doSetUp, deleteServerScripts];
|
|
||||||
if (html) {
|
if (html) {
|
||||||
|
const transforms = [doSetUp, deleteServerScripts];
|
||||||
|
|
||||||
for (const transform of transforms) {
|
for (const transform of transforms) {
|
||||||
html = transform(html.toString());
|
html = transform(html.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html = await useFragments(html.toString(), storage);
|
||||||
|
|
||||||
|
if (!!componentType && !!html) {
|
||||||
|
html = await insertRegistry(html.toString(), componentType, storage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html = await useFragments(html.toString(), storage);
|
return (
|
||||||
|
html ??
|
||||||
if (!!componentType && !!html) {
|
new Response(
|
||||||
html = await insertRegistry(html.toString(), componentType, storage);
|
"😱 ERROR 404: Not found. You can put a 404.html on the ./pages directory to customize this error page.",
|
||||||
}
|
{ status: 404 }
|
||||||
|
)
|
||||||
return html ?? new Response("Not found", { status: 404 });
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue