Skip to content
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

Errors from Pouch are swallowed #7

Closed
dave-irvine opened this issue May 27, 2019 · 6 comments
Closed

Errors from Pouch are swallowed #7

dave-irvine opened this issue May 27, 2019 · 6 comments

Comments

@dave-irvine
Copy link

dave-irvine commented May 27, 2019

Hi!

Great work on this library, but I think I found an issue.

If you pass some parameter to useFind that causes Pouch to throw an error (my problem was I asked to sort on a column that has no index), this error is swallowed and never shows up in the console. I had to step deep into the code stack to eventually find the error:

Unhandled promise rejection Error: "Cannot sort on field(s) "firstName" when using the default index"
    validateSort index-browser.es.js:501
    1 index-browser.es.js:1216
    run es.promise.js:97
    notify es.promise.js:114
    flush microtask.js:25
    argsArray index.js:18
    _callee$ useFind.js:55
    tryCatch runtime.js:45
    invoke runtime.js:271
    method runtime.js:97
    asyncGeneratorStep asyncToGenerator.js:3
    _next asyncToGenerator.js:25
    run es.promise.js:97
    notify es.promise.js:114
    flush microtask.js:25

The result of this is that useFind() returns undefined and you never know there was a problem. Now that I know the problem I can sort out my index, but the issue I am reporting is that react-pouchdb swallows errors from Pouch.

@ArnoSaine
Copy link
Owner

Hi!

Thank you for the support and submitting this issue.

It's a real issue. I think errors could be thrown and captured using an error boundary. Fixing this will take a few moments, because I'll also rewrite and simplify the subscription logic.

@gajus
Copy link

gajus commented Aug 2, 2019

Just started using this library and quickly ran into the same issue.

@ArnoSaine
Copy link
Owner

@gajus, nice to get new users! Could you try the new beta release, npm i react-pouchdb@next? This should be fixed in that release.

Change log:
https://github.com/ArnoSaine/react-pouchdb/blob/next/CHANGELOG.md#200-beta0

Docs:
https://www.npmjs.com/package/react-pouchdb/v/2.0.0-beta.1

@gajus
Copy link

gajus commented Aug 2, 2019

Sorry, stripped PouchDB from client and ended up writing an adhoc "database" using https://github.com/paularmstrong/normalizr. It is better suited for an esoteric task that I have.

@ArnoSaine
Copy link
Owner

Ok, no worries 🙂

@ArnoSaine
Copy link
Owner

Fixed in 2.0.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants