Open xgqfrms opened 2 years ago
import Vue from 'vue';
import { Vue as VueIntegration } from '@sentry/integrations';
// import * as
import * as Sentry from '@sentry/browser';
import * as PACKAGE from '../../package.json';
class ErrorHandler {
constructor (name) {
this.name = name || ErrorHandler.name;
}
onError (err, vm, info) {
// Sentry 错误上报
console.log('❌ Vue error', err);
console.log('❌ Vue vm', vm);
console.log('❌ Vue info', info);
}
}
if (window.location.host === 'app.xgqfrms.xyz') {
Sentry.init({
environment: 'prod',
ignoreErrors: [
'ResizeObserver loop limit exceeded',
'ResizeObserver loop completed with undelivered notifications'
],
release: `${PACKAGE.name}@${PACKAGE.version}`,
dsn: 'https://302ed2bbe24f05e67fc9fde5eb51410d@sentry.xgqfrms.xyz//10',
integrations: [new VueIntegration({Vue, attachProps: true, logErrors: true})],
});
const errorHandler = new ErrorHandler('vue_error');
Vue.config.errorHandler = (err, vm, info) => errorHandler.onError(err, vm, info);
}
ES6 import module without from