perf: sentry和posthog增加try...catch保护

pull/64/head
moonrailgun 3 years ago
parent 67960ac877
commit 1d924f1692

@ -1,6 +1,7 @@
import posthog from 'posthog-js'; import posthog from 'posthog-js';
import { sharedEvent } from '@capital/common'; import { sharedEvent } from '@capital/common';
try {
posthog.init('phc_xRCv3qbbOBMQkz31kbYMngXxn7Ey5JMu0BZIFktO6km', { posthog.init('phc_xRCv3qbbOBMQkz31kbYMngXxn7Ey5JMu0BZIFktO6km', {
api_host: 'https://app.posthog.com', api_host: 'https://app.posthog.com',
autocapture: false, // 关闭autocapture以节约事件用量 autocapture: false, // 关闭autocapture以节约事件用量
@ -49,3 +50,6 @@ sharedEvent.on('loginSuccess', (userInfo) => {
temporary: userInfo.temporary, temporary: userInfo.temporary,
}); });
}); });
} catch (err) {
console.error(err);
}

@ -2,6 +2,7 @@ import * as Sentry from '@sentry/react';
import { BrowserTracing } from '@sentry/tracing'; import { BrowserTracing } from '@sentry/tracing';
import { sharedEvent } from '@capital/common'; import { sharedEvent } from '@capital/common';
try {
Sentry.init({ Sentry.init({
dsn: 'https://177fd98a1e9e4deba84146a769633c32@o4504196236836864.ingest.sentry.io/4504196241293312', dsn: 'https://177fd98a1e9e4deba84146a769633c32@o4504196236836864.ingest.sentry.io/4504196241293312',
replaysSessionSampleRate: 0, replaysSessionSampleRate: 0,
@ -23,3 +24,6 @@ sharedEvent.on('loginSuccess', (userInfo) => {
temporary: userInfo.temporary, temporary: userInfo.temporary,
}); });
}); });
} catch (err) {
console.error(err);
}

Loading…
Cancel
Save