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

filter function can throw uncatchable errors #3356

Closed
marten-de-vries opened this issue Jan 7, 2015 · 2 comments

Comments

@marten-de-vries
Copy link
Member

commented Jan 7, 2015

var PouchDB = require('pouchdb');
var db = new PouchDB('test', {db: require('memdown')});
db.put({
  _id: "_design/test",
  filters: {
    test: function (doc, req) {
      throw new Error(); // syntaxerrors can't be caught either.
    }.toString()
  }
})
db.changes({filter: 'test/test'}).catch(function (err) {
  console.log("this statement is never reached although an error is thrown.")
});

Why is this bad? Because it crashes express-pouchdb. For bonus points, also known as skipping less of couchdb-harness, making the second argument of a filter function req specifiable as an option to changes() would be nice.

@nolanlawson

This comment has been minimized.

Copy link
Member

commented Jan 7, 2015

Ouch. Same thing happens with map/reduce functions btw.

@daleharvey daleharvey added the bug label Aug 4, 2015

daleharvey added a commit that referenced this issue Sep 8, 2015
daleharvey added a commit that referenced this issue Sep 9, 2015
daleharvey added a commit that referenced this issue Sep 9, 2015
daleharvey added a commit that referenced this issue Sep 9, 2015
@nolanlawson

This comment has been minimized.

Copy link
Member

commented Sep 10, 2015

fixed by 12cfc59

nolanlawson added a commit that referenced this issue Sep 10, 2015
nolanlawson added a commit that referenced this issue Sep 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.