mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Fix: show correct error log on 5xx error (#3137)
* fix: show correct error log on 5xx error * chore: changeset
This commit is contained in:
parent
efa6f7d662
commit
facf8016e2
2 changed files with 7 additions and 2 deletions
5
.changeset/wild-geckos-rule.md
Normal file
5
.changeset/wild-geckos-rule.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix: show correct stacktrace on dev server errors, instead of cryptic "package.json" error
|
|
@ -128,7 +128,7 @@ async function handle500Response(
|
||||||
res: http.ServerResponse,
|
res: http.ServerResponse,
|
||||||
err: any
|
err: any
|
||||||
) {
|
) {
|
||||||
const pathname = decodeURI(new URL(origin + req.url).pathname);
|
const pathname = decodeURI(new URL('./index.html', origin + req.url).pathname);
|
||||||
const html = serverErrorTemplate({
|
const html = serverErrorTemplate({
|
||||||
statusCode: 500,
|
statusCode: 500,
|
||||||
title: 'Internal Error',
|
title: 'Internal Error',
|
||||||
|
@ -137,7 +137,7 @@ async function handle500Response(
|
||||||
url: err.url || undefined,
|
url: err.url || undefined,
|
||||||
stack: stripAnsi(err.stack),
|
stack: stripAnsi(err.stack),
|
||||||
});
|
});
|
||||||
const transformedHtml = await viteServer.transformIndexHtml(pathname, html, pathname);
|
const transformedHtml = await viteServer.transformIndexHtml(pathname, html);
|
||||||
writeHtmlResponse(res, 500, transformedHtml);
|
writeHtmlResponse(res, 500, transformedHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue