Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue.js 3's alternative of `Vue.config.errorHandler`

Airbrake's Vue configuration page is still about Vue 2:

Vue.config.errorHandler = function (err, vm, info) {
  airbrake.notify({
    error: err,
    params: {info: info}
  });
}

What is the equivalent for Vue.js 3?

like image 888
akauppi Avatar asked Sep 06 '20 19:09

akauppi


People also ask

What is createApp in Vue?

The createApp API allows multiple Vue applications to co-exist on the same page, each with its own scope for configuration and global assets: js const app1 = createApp({ /* ... */ }) app1.

Is Vue 3 stable now?

It is definitely advisable to use Vue 3 in 2022. The only exceptions are when you already have a large code-base or your dependencies do not yet support Vue 3. However, in most cases, even to make your large code-bases compatible with Vue 3, you need to do minimal changes.

How do you use suspense in Vue 3?

To use Suspense, you put the asynchronous component into the default slot and your fallback loading state into the fallback slot. An asynchronous component is one of two things: A component with an async setup function — returning a Promise or using top-level await with script setup.

What changed Vue 3?

Other changes in Vue 3:Virtual DOM rewrite for better performance and improved TypeScript support. Native portals – now called Teleport. Fragments (virtual elements that won't be rendered in the DOM tree) More flexibility for global mounting.


1 Answers

It's the same in vue 3 with a little change which is the use of Vue instead (instance of createApp()) instance of Vue class :

import { createApp } from "vue";
import App from "./App.vue";

let app=createApp(App)

app.config.errorHandler = function (err, vm, info) {
  airbrake.notify({
    error: err,
    params: {info: info}
  });
}
app.mount("#app");

like image 84
Boussadjra Brahim Avatar answered Nov 15 '22 07:11

Boussadjra Brahim