diff --git a/src/components/errorBoundary.jsx b/src/components/errorBoundary.jsx
new file mode 100644
index 0000000..0142bc9
--- /dev/null
+++ b/src/components/errorBoundary.jsx
@@ -0,0 +1,22 @@
+import Raven from 'raven-js';
+import { Component } from 'react';
+import GenericErrorMessage from './genericErrorMessage';
+
+class ErrorBoundary extends Component {
+ state = { hasError: false }
+
+ componentDidCatch(error, info) {
+ this.setState({ info, error });
+ Raven.captureException(error);
+ Raven.captureMessage(info);
+ }
+
+ render() {
+ if (this.state.hasError) {
+ return ;
+ }
+ return this.props.children;
+ }
+}
+
+export default ErrorBoundary;
diff --git a/src/components/genericErrorMessage.jsx b/src/components/genericErrorMessage.jsx
new file mode 100644
index 0000000..ba0fed0
--- /dev/null
+++ b/src/components/genericErrorMessage.jsx
@@ -0,0 +1,10 @@
+import settings from '../settings';
+
+const GenericErrorMessage = () => (
+
+ There has been a critical error. Please
+ file an issue.
+
+);
+
+export default GenericErrorMessage;
diff --git a/src/containers/summary.jsx b/src/containers/summary.jsx
index 9a43147..3ee31af 100644
--- a/src/containers/summary.jsx
+++ b/src/containers/summary.jsx
@@ -3,6 +3,7 @@ import ReactInterval from 'react-interval';
import Summary from '../components/summary';
import ChangesetFilter from '../components/changesetFilter';
+import GenericErrorMessage from '../components/genericErrorMessage';
import settings from '../settings';
import { arrayToMap, mapToArray } from '../utils/data';
import { getCoverage } from '../utils/coverage';
@@ -117,7 +118,7 @@ export default class SummaryContainer extends Component {
const viewableCsetsMap = {};
changesets.forEach((cset) => {
- if (coverageMap[cset.node].show &&
+ if (coverageMap[cset.node] && coverageMap[cset.node].show &&
cset.desc.search(descriptionFilterValue) !== -1) {
viewableCsetsMap[cset.node] = cset;
}
@@ -148,10 +149,7 @@ export default class SummaryContainer extends Component {
/>
}
{(!pollingEnabled && Object.keys(viewableCsetsMap) === 0) &&
-
- There is currently no coverage data to show. Please
- file an issue.
-
+
}
{Object.keys(changesets).length === 0 &&
({LOADING}
)
diff --git a/src/index.jsx b/src/index.jsx
index dfc234c..35c21bd 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -3,14 +3,19 @@ import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import { HashRouter } from 'react-router-dom';
import App from './components/app';
+import Boundary from './components/errorBoundary';
-Raven.config('https://60b05bc4ef794a6c9e30e86e6a316083@sentry.io/300397').install();
+if (process.env.NODE_ENV === 'production') {
+ Raven.config('https://60b05bc4ef794a6c9e30e86e6a316083@sentry.io/300397').install();
+}
const root = document.getElementById('root');
const load = () => render(
-
+
+
+
,
root,
diff --git a/src/settings.js b/src/settings.js
index 20e0a8d..d14e993 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -1,6 +1,5 @@
const settings = {
ACTIVE_DATA: 'https://activedata.allizom.org',
- BACKEND: 'https://coverage.moz.tools',
BZ_URL: 'https://bugzilla.mozilla.org',
CACHE_CONFIG: {
SECONDS_TO_EXPIRE: 1 * 60 * 60, // 1 hour
diff --git a/src/utils/coverage.js b/src/utils/coverage.js
index f8f102f..6ef3094 100644
--- a/src/utils/coverage.js
+++ b/src/utils/coverage.js
@@ -4,12 +4,12 @@ import { jsonPost, jsonFetch, plainFetch } from './fetch';
import { queryCacheWithFallback } from './localCache';
const {
- ACTIVE_DATA, BACKEND, CCOV_BACKEND, CODECOV_GECKO_DEV, GH_GECKO_DEV,
+ ACTIVE_DATA, CCOV_BACKEND, CODECOV_GECKO_DEV, GH_GECKO_DEV,
} = settings;
export const githubUrl = gitCommit => `${GH_GECKO_DEV}/commit/${gitCommit}`;
export const codecovUrl = gitCommit => (`${CODECOV_GECKO_DEV}/commit/${gitCommit}`);
-export const ccovBackendUrl = node => (`${BACKEND}/coverage/changeset/${node}`);
+export const ccovBackendUrl = node => (`${CCOV_BACKEND}/coverage/changeset/${node}`);
const queryChangesetCoverage = node =>
plainFetch(`${CCOV_BACKEND}/coverage/changeset/${node}`);
@@ -145,7 +145,7 @@ export const getChangesetCoverage = async (node) => {
if (!node) {
throw Error(`No node for cset: ${node}`);
}
- let coverage = { show: false, node };
+ let coverage = { show: false };
const res = await queryChangesetCoverage(node);
if (res.status === 202) {
// This is the only case when we poll again
@@ -158,6 +158,7 @@ export const getChangesetCoverage = async (node) => {
} else {
console.warning(`Unexpected HTTP code (${res.status}) for ${coverage}`);
}
+ coverage.node = node;
return coverage;
};