blob: d254630d1e46de764d009547cfee44a178428800 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import Vue from 'vue';
const modifiedInstances = [];
export function setVueErrorHandler({ instance, handler }) {
if (Vue.version.startsWith('2')) {
// only global handlers are supported
const { config } = Vue;
config.errorHandler = handler;
return;
}
// eslint-disable-next-line no-param-reassign
instance.$.appContext.config.errorHandler = handler;
modifiedInstances.push(instance);
}
export function resetVueErrorHandler() {
if (Vue.version.startsWith('2')) {
const { config } = Vue;
config.errorHandler = null;
return;
}
modifiedInstances.forEach((instance) => {
// eslint-disable-next-line no-param-reassign
instance.$.appContext.config.errorHandler = null;
});
modifiedInstances.length = 0;
}
|