Skip to content

Commit

Permalink
make error.message enumerable - fixes #9010
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Harris committed Mar 17, 2023
1 parent 23cf4ab commit 9f99234
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sharp-trainers-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: make `error.message` enumerable when sending `ssrLoadModule` error to client
10 changes: 9 additions & 1 deletion packages/kit/src/exports/vite/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ export async function dev(vite, vite_config, svelte_config) {
const msg = buildErrorMessage(err, [colors.red(`Internal server error: ${err.message}`)]);

vite.config.logger.error(msg, { error: err });
vite.ws.send({ type: 'error', err: err });
vite.ws.send({ type: 'error',
err: {
...err,
// these properties are non-enumerable and will
// not be serialized unless we explicitly include them
message: err.message,
stack: err.stack
}
});

throw err;
}
Expand Down

0 comments on commit 9f99234

Please sign in to comment.