Commit 9381262b authored by 张子雨's avatar 张子雨

Merge branch 'feat/sentry' into 'master'

Feat/sentry

See merge request !81
parents e111857f 9db2165e
This source diff could not be displayed because it is too large. You can view the blob instead.
/* eslint-disable no-console */
import * as Sentry from '@sentry/react';
import localStorage from '@/utils/localStorage';
// process.env.SENTRY_ENV !== 'test' 加上测试环境不会报错
if (process.env.NODE_ENV === 'production' && process.env.SENTRY_ENV !== 'test') {
try {
Sentry.init({
dsn: 'https://b3f60c62e1234e26a5b851b9f26fba07@sentry.q-gp.com/34',
release: 'merchant-manage-ui@1.0.0',
maxBreadcrumbs: 50,
tracesSampleRate: 1,
beforeSend: e => {
const err = e.exception?.values || [];
// XXX 不上报[object Object]此类基础库异常
if (err.some(item => item.value.indexOf('ResizeObserver') > -1)) {
return null;
}
return e;
},
});
Sentry.configureScope(scope => {
scope.setUser({
token: localStorage.get('token') || null,
});
});
} catch (e) {
console.log('Sentry无法加载', e);
}
}
export const dva = {
config: {
......
......@@ -100,9 +100,12 @@ class Socket extends EventEmitter {
};
onerror = e => {
console.log('ws: error', e);
this.socket = null;
this.event.emit('error', e);
try {
this.socket = null;
this.event.emit('error', e);
} catch {
console.log('ws: error', e);
}
};
sendMessage = value => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment