mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): preserve render errors (#8884)
* fix(nuxt): preserve render errors * simplify logic
This commit is contained in:
parent
0ff4ebe808
commit
83b5c09090
@ -172,18 +172,13 @@ export default defineRenderHandler(async (event) => {
|
||||
writeEarlyHints(event, link)
|
||||
}
|
||||
|
||||
const _rendered = await renderer.renderToString(ssrContext).catch((err) => {
|
||||
if (!ssrError) {
|
||||
// Use explicitly thrown error in preference to subsequent rendering errors
|
||||
throw ssrContext.payload?.error || err
|
||||
}
|
||||
const _rendered = await renderer.renderToString(ssrContext).catch((error) => {
|
||||
// Use explicitly thrown error in preference to subsequent rendering errors
|
||||
throw (!ssrError && ssrContext.payload?.error) || error
|
||||
})
|
||||
await ssrContext.nuxt?.hooks.callHook('app:rendered', { ssrContext })
|
||||
|
||||
// Handle errors
|
||||
if (!_rendered) {
|
||||
return undefined!
|
||||
}
|
||||
if (ssrContext.payload?.error && !ssrError) {
|
||||
throw ssrContext.payload.error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user