## Expected Behavior

 * When using promises ;
 * When `db.get` returns 404 (because the document is missing) ;
 * Then I expect **either of** `.then` or `.catch` callback to be called.

## Current Behavior

 * When using promises ;
 * When `db.get` returns 404 (because the document is missing) ;
 * Then **both** `.then` and `.catch` callbacks are called.

## Steps to Reproduce (for bugs)


```js
const rnd = Math.random();
db.get(id)
.then((body) => console.log({rnd, body}))
.catch(err) => console.log({rnd, err}));
```

Output:
```
{
   rnd: 0.9767401252511854,
   err: { Error: missing
at Request._callback (/node_modules/nano/lib/nano.js:151:15)
at Request.self.callback (/node_modules/request/request.js:185:22)
[...],
name: 'Error',
error: 'not_found',
reason: 'missing',
scope: 'couch',
statusCode: 404,
[...]
   }
}

{
  rnd: 0.9767401252511854,
  body: undefined
}
```

## Context

Check if a document is already in the database.

## Your Environment

Node v10 on Docker (image `node:10`).

[ Full content available at: https://github.com/apache/couchdb-nano/issues/124 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to