fix(node): report render error to the terminal (#8599)
This commit is contained in:
parent
1f1c47d909
commit
2e1d5f8739
2 changed files with 8 additions and 0 deletions
5
.changeset/curly-icons-watch.md
Normal file
5
.changeset/curly-icons-watch.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/node': patch
|
||||
---
|
||||
|
||||
The node adapter now logs uncaught errors encountered during rendering a page.
|
|
@ -51,6 +51,9 @@ export default function (app: NodeApp, mode: Options['mode']) {
|
|||
await writeWebResponse(app, res, response);
|
||||
}
|
||||
} catch (err: unknown) {
|
||||
const logger = app.getAdapterLogger()
|
||||
logger.error(`Could not render ${req.url}`)
|
||||
console.error(err)
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(500, `Server error`);
|
||||
res.end();
|
||||
|
|
Loading…
Reference in a new issue