From 6b6ad70fd753147466e4c4943ab10789ebcbcd38 Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Thu, 27 Jan 2022 23:18:34 +0700 Subject: [PATCH] =?UTF-8?q?docs:=20delegate=20error=20handling=20to=20expr?= =?UTF-8?q?ess=E2=80=99s=20error=20handler=20(#6611)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/ssr.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/guide/ssr.md b/docs/guide/ssr.md index e60f06e12789ed..d1fca329abd58d 100644 --- a/docs/guide/ssr.md +++ b/docs/guide/ssr.md @@ -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 { @@ -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) } }) ```