disable sentry

This commit is contained in:
Sean Yesmunt 2020-02-05 09:45:20 -05:00
parent e69703436a
commit 2eb822b33e
3 changed files with 54 additions and 26 deletions

View file

@ -1,7 +1,7 @@
// @flow
import { Lbryio } from 'lbryinc';
import ReactGA from 'react-ga';
import * as Sentry from '@sentry/browser';
// import * as Sentry from '@sentry/browser';
import { history } from './store';
// @if TARGET='app'
import Native from 'native';
@ -22,7 +22,8 @@ ElectronCookies.enable({
// @endif
type Analytics = {
error: ({}, {}) => Promise<any>,
// error: ({}, {}) => Promise<any>,
error: string => void,
pageView: string => void,
setUser: Object => void,
toggle: (boolean, ?boolean) => void,
@ -49,18 +50,23 @@ type LogPublishParams = {
let analyticsEnabled: boolean = isProduction;
const analytics: Analytics = {
error: (error, errorInfo) => {
return new Promise(resolve => {
error: message => {
if (analyticsEnabled && isProduction) {
Sentry.withScope(scope => {
scope.setExtras(errorInfo);
const eventId = Sentry.captureException(error);
resolve(eventId);
});
} else {
resolve(null);
Lbryio.call('event', 'desktop_error', { error_message: message });
}
});
// Temporarily disabling sentry
// error: (error, errorInfo) => {
// return new Promise(resolve => {
// if (analyticsEnabled && isProduction) {
// Sentry.withScope(scope => {
// scope.setExtras(errorInfo);
// const eventId = Sentry.captureException(error);
// resolve(eventId);
// });
// } else {
// resolve(null);
// }
// });
},
pageView: path => {
if (analyticsEnabled) {

View file

@ -6,6 +6,8 @@ import Button from 'component/button';
import { withRouter } from 'react-router';
import analytics from 'analytics';
import I18nMessage from 'component/i18nMessage';
import Native from 'native';
import { Lbry } from 'lbry-redux';
type Props = {
children: Node,
@ -32,9 +34,29 @@ class ErrorBoundary extends React.Component<Props, State> {
}
componentDidCatch(error, errorInfo) {
analytics.error(error, errorInfo).then(eventId => {
this.setState({ eventId });
// analytics.error(error, errorInfo).then(eventId => {
// this.setState({ eventId });
// });
let errorMessage = 'Uncaught error\n';
// @if TARGET='web'
errorMessage += 'lbry.tv\n';
errorMessage += `page: ${window.location.pathname + window.location.search}\n`;
errorMessage += error.stack;
analytics.error(errorMessage);
// @endif
// @if TARGET='app'
Native.getAppVersionInfo().then(({ localVersion }) => {
Lbry.version().then(({ lbrynet_version: sdkVersion }) => {
errorMessage += `app version: ${localVersion}\n`;
errorMessage += `sdk version: ${sdkVersion}\n`;
errorMessage += `page: ${window.location.href.split('.html')[1]}\n`;
errorMessage += `${error.stack}`;
analytics.error(errorMessage);
});
});
// @endif
}
refresh() {
@ -46,7 +68,7 @@ class ErrorBoundary extends React.Component<Props, State> {
}
render() {
const { hasError, eventId } = this.state;
const { hasError } = this.state;
if (hasError) {
return (
@ -72,7 +94,7 @@ class ErrorBoundary extends React.Component<Props, State> {
</I18nMessage>
}
/>
{eventId === null && (
{/* {eventId === null && (
<div className="error-wrapper">
<span className="error-text">
{__('You are not currently sharing diagnostic data so this error was not reported.')}
@ -83,7 +105,7 @@ class ErrorBoundary extends React.Component<Props, State> {
<div className="error-wrapper">
<span className="error-text">{__('Error ID: %eventId%', { eventId })}</span>
</div>
)}
)} */}
</div>
);
}

View file

@ -1,5 +1,5 @@
import 'babel-polyfill';
import * as Sentry from '@sentry/browser';
// import * as Sentry from '@sentry/browser';
import ErrorBoundary from 'component/errorBoundary';
import App from 'component/app';
import SnackBar from 'component/snackBar';
@ -47,12 +47,12 @@ import apiPublishCallViaWeb from 'lbrytv/setup/publish';
// Will only work if you have a SENTRY_AUTH_TOKEN env
// We still add code in analytics.js to send the error to sentry manually
// If it's caught by componentDidCatch in component/errorBoundary, it will not bubble up to this error reporter
if (process.env.NODE_ENV === 'production') {
Sentry.init({
dsn: 'https://f93af3fa9c94470d9a0a22602cce3154@sentry.io/1877677',
blacklistUrls: ['assets.revcontent.com'],
});
}
// if (process.env.NODE_ENV === 'production') {
// Sentry.init({
// dsn: 'https://f93af3fa9c94470d9a0a22602cce3154@sentry.io/1877677',
// blacklistUrls: ['assets.revcontent.com'],
// });
// }
const PROXY_PATH = 'api/v1/proxy';
export const SDK_API_URL = `${process.env.SDK_API_URL}/${PROXY_PATH}` || `https://api.lbry.tv/${PROXY_PATH}`;