Skip to content

Commit

Permalink
docs: delegate error handling to express’s error handler (#6611)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth committed Jan 27, 2022
1 parent 678e0f2 commit 6b6ad70
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Here `vite` is an instance of [ViteDevServer](./api-javascript#vitedevserver). `
The next step is implementing the `*` handler to serve server-rendered HTML:
```js
app.use('*', async (req, res) => {
app.use('*', async (req, res, next) => {
const url = req.originalUrl

try {
Expand Down Expand Up @@ -134,8 +134,7 @@ app.use('*', async (req, res) => {
// If an error is caught, let Vite fix the stracktrace so it maps back to
// your actual source code.
vite.ssrFixStacktrace(e)
console.error(e)
res.status(500).end(e.message)
next(e)
}
})
```
Expand Down

0 comments on commit 6b6ad70

Please sign in to comment.