diff --git a/_src/js/compare/index.jsx b/_src/js/compare/index.jsx
index ade94571..efec818b 100644
--- a/_src/js/compare/index.jsx
+++ b/_src/js/compare/index.jsx
@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom';
import {Nav, NavItem, Tab} from 'react-bootstrap';
import Select from 'react-select';
import {schemeSet2 as colors} from 'd3-scale-chromatic';
+import _ from 'lodash';
import 'react-select/dist/react-select.css';
@@ -57,6 +58,7 @@ class Compare extends React.Component {
usePct: true,
budgetChoices: [],
totals: [],
+ error: null
};
this.updateChangeType = this.updateChangeType.bind(this);
this.selectBudget = this.selectBudget.bind(this);
@@ -83,6 +85,9 @@ class Compare extends React.Component {
budget1Options,
budget2Options,
});
+ })
+ .catch(error => {
+ this.setState({error: error.response});
});
}
@@ -127,9 +132,15 @@ class Compare extends React.Component {
};
}
});
+ const error = this.state.error;
+
+ const errorMessage = _.isNull(error) ?
+ (
) :
+ ({error}
);
return
+ {errorMessage}
Compare
,
document.getElementById('root')
-);
\ No newline at end of file
+);
diff --git a/_src/package.json b/_src/package.json
index b92175fd..c8d47288 100644
--- a/_src/package.json
+++ b/_src/package.json
@@ -7,6 +7,7 @@
"d3-format": "^1.0.2",
"d3-scale-chromatic": "^1.1.1",
"fsevents": "^1.2.4",
+ "lodash": "^4.17.10",
"react": "^15.4.1",
"react-bootstrap": "^0.30.8",
"react-chartjs-2": "^2.0.0",
diff --git a/_src/yarn.lock b/_src/yarn.lock
index cd3e04ee..1e0630c7 100644
--- a/_src/yarn.lock
+++ b/_src/yarn.lock
@@ -2149,6 +2149,10 @@ lodash@^4.14.0, lodash@^4.2.0:
version "4.17.2"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"
+lodash@^4.17.10:
+ version "4.17.10"
+ resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
+
longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"