cloudhead/cradle — pull request #235 by holic (2013-11-30 01:00:10+00:00)
Title: Add CouchError to wrap REST errors in Error object

Allows for proper handling of Error objects in callbacks (e.g. `throw err` and `next(err)`)

```js
db.view('some/view', function (err, res) {
// errors extend the Error object
err instanceof Error; // true

// errors are now throwable
if (err) throw err;

// errors can also be used with Express.js to pass request to error handler
if (err) return next(err);

// ...
});
```
See #216 and #213.