mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 01:15:58 +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))
|
||||
}
|
||||
|
||||
if (event.handled) { return }
|
||||
|
||||
const html = await youch.toHTML(error, {
|
||||
title: `${errorObject.statusCode}`,
|
||||
request: {
|
||||
url,
|
||||
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()) {
|
||||
setResponseHeader(event, header, value)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user