fix(nuxt): suppress handled errors (#20002)

This commit is contained in:
Daniel Roe 2023-03-31 10:17:10 +01:00 committed by GitHub
parent 434e2013e4
commit 4ed5d2f872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -37,6 +37,7 @@ onErrorCaptured((err, target, info) => {
if (process.server || (isNuxtError(err) && (err.fatal || err.unhandled))) {
const p = callWithNuxt(nuxtApp, showError, [err])
onServerPrefetch(() => p)
return false // suppress error from breaking render
}
})

View File

@ -238,8 +238,9 @@ export function createNuxtApp (options: CreateOptions) {
})
// Log errors captured when running plugins, in the `app:created` and `app:beforeMount` hooks
// as well as when mounting the app and in the `app:mounted` hook
nuxtApp.hook('app:error', (...args) => { console.error('[nuxt] error caught during app initialization', ...args) })
// as well as when mounting the app.
const unreg = nuxtApp.hook('app:error', (...args) => { console.error('[nuxt] error caught during app initialization', ...args) })
nuxtApp.hook('app:mounted', unreg)
}
// Expose runtime config