Vue & Sentry & ErrorHandler
Vue & Sentry & ErrorHandler
import * as Sentry from '@sentry/browser';
import { Vue as VueIntegration } from '@sentry/integrations';
import ErrorHandler from './ErrorHandler.js';
import * as PACKAGE from '../package.json';
const env = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';
if(env === 'prod' && window.location.host === 'app.xgqfrms.com') {
// 仅用于 prod 环境
Sentry.init({
environment: `${env === 'prod' ? '生产环境' : '测试环境'}`,
ignoreErrors: ['ResizeObserver loop limit exceeded'],
release: `${PACKAGE.name}@${PACKAGE.version}`,
dsn: 'https://10101010101010101010@sentry.xgqfrms.com//2020',
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);
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14342332.html
未经授权禁止转载,违者必究!