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

Commit

Permalink
tweak error format
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Whitton committed Apr 2, 2018
1 parent ab86a51 commit 68d3580
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions routes/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function extractDistricts({ reps, divisions, normalizedInput }) {
function checkResponse(body) {
let { error } = body;
if (error) {
throw { error: error.errors, code: 400, message: error.message };
throw { error: { code: 400, message: error.message }};
} else {
return body;
}
Expand All @@ -53,7 +53,7 @@ router.get('/', function(req, res) {
.then(d => res.send(d))
.catch(e => {
console.error(e);
res.status(500 || e.code).send(e);
res.status(e.error.code || 500).send(e);
});
} else {
res.status(400).send({
Expand Down

0 comments on commit 68d3580

Please sign in to comment.