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

Commit

Permalink
servers: fix '/connections/:id' error response
Browse files Browse the repository at this point in the history
* Ensure error response is formatted as {error: message: 'xxxx'}.
  • Loading branch information
n-riesco committed May 18, 2018
1 parent 103db20 commit 71fe981
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,11 @@ export default class Servers {
return next();
}
Logger.log(validation, 2);
res.json(400, {error: validation.message});
res.json(400, {error: {message: validation.message}});
return next();
}).catch(err => {
Logger.log(err, 2);
res.json(400, {error: err.message});
res.json(400, {error: {message: err.message}});
return next();
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/backend/routes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ describe('Routes:', () => {
.then(getResponseJson).then(json => {
assert.deepEqual(
json,
{error: 'password authentication failed for user "banana"'}
{error: {message: 'password authentication failed for user "banana"'}}
);
assert.deepEqual(
getConnections(),
Expand Down

0 comments on commit 71fe981

Please sign in to comment.