mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): log more context of prerendering errors (#28895)
This commit is contained in:
parent
d5cf409ddc
commit
43d34f4a70
@ -31,7 +31,7 @@ export default <NitroErrorHandler> async function errorhandler (error: H3Error,
|
|||||||
error.fatal && '[fatal]',
|
error.fatal && '[fatal]',
|
||||||
Number(errorObject.statusCode) !== 200 && `[${errorObject.statusCode}]`,
|
Number(errorObject.statusCode) !== 200 && `[${errorObject.statusCode}]`,
|
||||||
].filter(Boolean).join(' ')
|
].filter(Boolean).join(' ')
|
||||||
console.error(tags, errorObject.message + '\n' + stack.map(l => ' ' + l.text).join(' \n'))
|
console.error(tags, (error.message || error.toString() || 'internal server error') + '\n' + stack.map(l => ' ' + l.text).join(' \n'))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.handled) { return }
|
if (event.handled) { return }
|
||||||
@ -119,7 +119,7 @@ function normalizeError (error: any) {
|
|||||||
// Hide details of unhandled/fatal errors in production
|
// Hide details of unhandled/fatal errors in production
|
||||||
const hideDetails = !import.meta.dev && error.unhandled
|
const hideDetails = !import.meta.dev && error.unhandled
|
||||||
|
|
||||||
const stack = hideDetails
|
const stack = hideDetails && !import.meta.prerender
|
||||||
? []
|
? []
|
||||||
: ((error.stack as string) || '')
|
: ((error.stack as string) || '')
|
||||||
.split('\n')
|
.split('\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user