Skip to content

Commit

Permalink
use adapter logger
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy committed Sep 19, 2023
1 parent 37462a0 commit 4a376b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/curly-icons-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/node': patch
---

The node adapter now logs uncaught errors encountered during rendering a page.
4 changes: 3 additions & 1 deletion packages/integrations/node/src/nodeMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default function (app: NodeApp, mode: Options['mode']) {
await writeWebResponse(app, res, response);
}
} catch (err: unknown) {
console.error(new Error(`Could not render ${req.url}`, { cause: err }))
const logger = app.getAdapterLogger()
logger.error(`Could not render ${req.url}`)
console.error(err)
if (!res.headersSent) {
res.writeHead(500, `Server error`);
res.end();
Expand Down

0 comments on commit 4a376b1

Please sign in to comment.