-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
catch errors thrown in diff function #9
Conversation
LGTM. Thanks! |
This reverts commit 374ff54.
@tyler-johnson Sorry, but I had to revert and unpublish this, because it broke a test in pouchdb itself. My bad for not running the test suite before merging. Here's the error:
|
So it seems like the error stems from the fact that tests are creating a fake database with a custom For reference, https://github.com/pouchdb/pouchdb/blob/master/tests/unit/test.mapreduce.js#L13-L17 |
If the PR broke the functionality of callbacks, then that's a bug, because this lib is supposed to support both callbacks and promises... Unless it's some other issue, in which case, yes, let's go ahead and fix the test. :) |
Upsert still supports callbacks. The test code is actually taking on the role of |
Ah gotcha. OK, well I have another suggestion for resolving this issue: pouchdb/pouchdb#4144 If we make it so PouchDB is no longer depending upon pouchdb-upsert, then we no longer need to worry about tests breaking in PouchDB when something changes in this module. |
Now that pouchdb/pouchdb#4144 has landed, can we get this one merged as well? |
Well unfortunately this is a breaking change, because it will break for anybody still running PouchDB <4.0.1 out there (because we were using semver I'm all for merging this and the other PRs that have been stalled, but yeah, it will require a new major version. |
This is definitely safe to merge now. I'm not concerned about breaking PouchDB <4.0.1; people should be updating. But I'll publish this as a major release anyway. |
Crap, this broke the build: #14 |
I noticed that errors being thrown in the diff function were crashing my program. I moved the upsert logic from the
get()
callback into a Promise chain. This fixed the issue and made the code a bit cleaner, IMO.