mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(error): reorder error handling logic to respect handled flag
Move HTML generation after event.handled check to prevent unnecessary error page generation for already handled errors.
This commit is contained in:
parent
5d74ae3c6b
commit
71ce7c3415
@ -80,7 +80,10 @@ export default <NitroErrorHandler> async function errorhandler (error: H3Error,
|
|||||||
return send(event, template(errorObject))
|
return send(event, template(errorObject))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.handled) { return }
|
||||||
|
|
||||||
const html = await youch.toHTML(error, {
|
const html = await youch.toHTML(error, {
|
||||||
|
title: `${errorObject.statusCode}`,
|
||||||
request: {
|
request: {
|
||||||
url,
|
url,
|
||||||
method: event.method,
|
method: event.method,
|
||||||
@ -88,8 +91,6 @@ export default <NitroErrorHandler> async function errorhandler (error: H3Error,
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (event.handled) { return }
|
|
||||||
|
|
||||||
for (const [header, value] of res.headers.entries()) {
|
for (const [header, value] of res.headers.entries()) {
|
||||||
setResponseHeader(event, header, value)
|
setResponseHeader(event, header, value)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user