daleharvey/pouchdb — pull request #318 by jlaxson (2012-12-30 03:22:46+00:00)
Title: Catch errors retrieving revisions during replication

If you are doing a replication such as:
```js
db.replicate("idb://localdb", "http://remotedb", {continuous: true})
```
and the network connection to the remote server drops while the replication is active, the interpreter will error out on the Object.keys(diffs) line (because an error was returned and diffs is null-ish. Instead, catch that error, canceling the continuous replication if applicable, and pass it on to the callback so the client has the opportunity to restart replication at a later date.

I don't know how to test this as it would require simulating a failed HTTP request, but happy to add that if you know how.