Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Implement versioning
Browse files Browse the repository at this point in the history
Update sentry
  • Loading branch information
cryogen committed Mar 15, 2024
1 parent 97c8eef commit 6382721
Show file tree
Hide file tree
Showing 7 changed files with 412 additions and 74 deletions.
10 changes: 7 additions & 3 deletions Components/Site/ErrorBoundary.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import Raven from 'raven-js';
import * as Sentry from '@sentry/browser';

class ErrorBoundary extends React.Component {
constructor(props) {
Expand All @@ -23,7 +23,11 @@ class ErrorBoundary extends React.Component {
componentDidCatch(error, info) {
this.setState({ error });

Raven.captureException(error, { extra: info });
Sentry.withScope((scope) => {
scope.setExtras(info);
const eventId = Sentry.captureException(error);
this.setState({ eventId });
});
}

onReturnClick(event) {
Expand All @@ -38,7 +42,7 @@ class ErrorBoundary extends React.Component {
if(this.state.error) {
return (<div
className='alert alert-danger'
onClick={ () => Raven.lastEventId() && Raven.showReportDialog() }>
onClick={ () => Sentry.showReportDialog({ eventId: this.state.eventId }) }>
<p>{ this.props.message }</p>
<p>There error has been logged, please click anywhere in this red box to fill out a more detailed report.</p>

Expand Down
3 changes: 1 addition & 2 deletions ReduxActions/socket.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import io from 'socket.io-client';

import version from '../version';
import * as actions from '../actions';

export function socketMessageSent(message) {
Expand Down Expand Up @@ -116,7 +115,7 @@ export function connectLobby() {
return (dispatch, getState) => {
let state = getState();
let queryString = state.auth.token ? 'token=' + state.auth.token + '&' : '';
queryString += 'version=' + version.releaseDate;
queryString += 'version=' + process.env.VERSION || 'Local build';

let socket = io.connect(window.location.origin, {
reconnection: true,
Expand Down
53 changes: 22 additions & 31 deletions index.prod.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,15 @@ import configureStore from './configureStore';
import { navigate } from './actions';
import 'bootstrap/dist/js/bootstrap';
import ReduxToastr from 'react-redux-toastr';
import Raven from 'raven-js';
import * as Sentry from '@sentry/browser';
import { DragDropContext } from 'react-dnd';
import { default as TouchBackend } from 'react-dnd-touch-backend';

import version from './version';
import ErrorBoundary from './Components/Site/ErrorBoundary';

const ravenOptions = {
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error. html
'originalCreateNotification',
'canvas.contentDocument',
'MyApp_RemoveAllHighlights',
'http://tt.epicplay.com',
'Can\'t find variable: ZiteReader',
'jigsaw is not defined',
'ComboSearch is not defined',
'http://loading.retry.widdit.com/',
'atomicFindClose',
// Facebook borked
'fb_xd_fragment',
// ISP "optimizing" proxy - `Cache-Control: no-transform` seems to
// reduce this. (thanks @acdha)
// See http://stackoverflow.com/questions/4113268
'bmi_SafeAddOnload',
'EBCallBackMessageReceived',
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
'conduitPage',
'YoukuAntiAds.eval'
],
ignoreUrls: [
const sentryOptions = {
dsn: 'https://[email protected]/1515148',
denyUrls: [
// Facebook flakiness
/graph\.facebook\.com/i,
// Facebook blocked
Expand All @@ -49,17 +25,32 @@ const ravenOptions = {
// Chrome extensions
/extensions\//i,
/^chrome:\/\//i,
/chrome-extension:/i,
// Other plugins
/127\.0\.0\.1:4001\/isrunning/i, // Cacaoweb
/webappstoolbarba\.texthelp\.com\//i,
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
/YoukuAntiAds\.eval/i
],
release: version.build
beforeSend(event, hint) {
if(
event.message &&
event.message.startsWith('Non-Error exception captured') &&
hint.originalException.error
) {
Sentry.withScope((scope) => {
scope.setExtra('nonErrorException', true);
Sentry.captureException(hint.originalException.error);
});
return null;
}

return event;
},
release: process.env.VERSION || 'Local build'
};

Raven.config('https://[email protected]/123019', ravenOptions)
.install();
Sentry.init(sentryOptions);

const store = configureStore();

Expand Down
Loading

0 comments on commit 6382721

Please sign in to comment.