Nuxt/examples/with-errors/plugins/error.ts
Daniel Roe 5d58ef48af
feat(nitro, nuxt3): allow handling otherwise unhandled runtime errors (#3464)
Co-authored-by: pooya parsa <pyapar@gmail.com>
2022-03-11 09:22:16 +01:00

21 lines
512 B
TypeScript

export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('vue:error', (..._args) => {
console.log('vue:error')
// if (process.client) {
// console.log(..._args)
// }
})
nuxtApp.hook('app:error', (..._args) => {
console.log('app:error')
// if (process.client) {
// console.log(..._args)
// }
})
nuxtApp.vueApp.config.errorHandler = (..._args) => {
console.log('global error handler')
// if (process.client) {
// console.log(..._args)
// }
}
})