Skip to content

Commit

Permalink
fix: improve error handling for CF workers
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Apr 6, 2021
1 parent 97530f0 commit 70a89e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/renderPage.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,9 @@ function handleErr(err: unknown) {
viteDevServer.ssrFixStacktrace(err)
}
}
console.error(err)
// We ensure we print a string; Cloudflare Workers doesn't seem to properly stringify `Error` objects.
const errStr = hasProp(err, 'stack') && String(err.stack) || String(err)
console.error(errStr)
}

function retrieveViteManifest(isPreRendering: boolean): { clientManifest: ViteManifest; serverManifest: ViteManifest } {
Expand Down

0 comments on commit 70a89e0

Please sign in to comment.