Skip to content
Index

[Vue.js] Set up global error handling

Tested with: Vue v3

To handle uncaught errors in your Vue app, you can use the errorHandler option to define a custom handler function.

app.config.errorHandler = (error, instance, info) => {
// `error` is the error that was thrown
// `instance` is the Vue component in which the error was thrown
// `info` is the error source type
};

You can use this handler to log errors to a tracking service like Sentry, for example.