Permalink
Browse files

fix(db-api): propagate all error fields, fixes #151

  • Loading branch information...
1 parent 3ee028e commit fdf154b03216ce5642e248c7c1c779aea90afe80 @philbooth philbooth committed Jul 1, 2015
Showing with 12 additions and 2 deletions.
  1. +6 −1 index.js
  2. +6 −1 test/backend/remote.js
View
@@ -47,7 +47,12 @@ function createServer(db) {
}
)
- res.send(statusCode, err)
+ res.send(statusCode, {
+ message: err.message,
+ errno: err.errno,
+ error: err.error,
+ code: err.code
+ })
}
)
.done(next, next)
@@ -44,7 +44,12 @@ function respOkEmpty(t, r) {
// Takes the test object (t) and the error object (err).
function testNotFound(t, err) {
t.equal(err.statusCode, 404, 'returns a 404')
- t.deepEqual(err.body, { message : 'Not Found' }, 'Object contains no other fields')
+ t.deepEqual(err.body, {
+ message: 'Not Found',
+ errno: 116,
+ error: 'Not Found',
+ code: 404
+ }, 'Object contains no other fields')
}
// To run these tests from a new backend, create a DB instance, start a test server

0 comments on commit fdf154b

Please sign in to comment.