<!--- Provide a general summary of the issue in the Title above -->
## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
Catching errors from db.head() calls shouldn't cause warnings:
```
.catch((error) => {
console.log('Error: ' + error.message);
});
```
Should just write the error to the console.
## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected
behavior -->
<!--- If suggesting a change/improvement, explain the difference from current
behavior -->
Although the error is handled, Node.js still emits an
`UnhandledPromiseRejectionWarning`
## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->
This appears to be because db.head() is wrapping a call to db.relax(), and not
handling promise rejections from the db.relax(). Propagating errors to the new
Promise (e.g. by adding something like `.catch((err) => {reject(err)})` )
should allow errors to be handled by the calling code.
## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
```
db.head('this-is-not-a-valid-id')
.then((header) => {console.log(header)})
.catch((error) => {
console.log('Error: ' + error.message);
});
```
## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in
the real world -->
Currently this just produces a warning message in Node.js.
## Your Environment
<!--- Include as many relevant details about the environment you experienced
the bug in -->
* Version used: 7.0.0
* Browser Name and version: Node.js 10.9.0
* Operating System and version (desktop or mobile): macOS 10.13.6 (17G65)
[ Full content available at: https://github.com/apache/couchdb-nano/issues/120 ]
This message was relayed via gitbox.apache.org for [email protected]