{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3356","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3356/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3356/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3356/events","html_url":"https://github.com/pouchdb/pouchdb/issues/3356","id":53630269,"number":3356,"title":"filter function can throw uncatchable errors","user":{"login":"marten-de-vries","id":1750170,"avatar_url":"https://avatars.githubusercontent.com/u/1750170?v=3","gravatar_id":"","url":"https://api.github.com/users/marten-de-vries","html_url":"https://github.com/marten-de-vries","followers_url":"https://api.github.com/users/marten-de-vries/followers","following_url":"https://api.github.com/users/marten-de-vries/following{/other_user}","gists_url":"https://api.github.com/users/marten-de-vries/gists{/gist_id}","starred_url":"https://api.github.com/users/marten-de-vries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marten-de-vries/subscriptions","organizations_url":"https://api.github.com/users/marten-de-vries/orgs","repos_url":"https://api.github.com/users/marten-de-vries/repos","events_url":"https://api.github.com/users/marten-de-vries/events{/privacy}","received_events_url":"https://api.github.com/users/marten-de-vries/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-07T13:04:30Z","updated_at":"2015-01-07T17:20:36Z","closed_at":null,"body":"```javascript\r\nvar PouchDB = require('pouchdb');\r\nvar db = new PouchDB('test', {db: require('memdown')});\r\ndb.put({\r\n  _id: \"_design/test\",\r\n  filters: {\r\n    test: function (doc, req) {\r\n      throw new Error(); // syntaxerrors can't be caught either.\r\n    }.toString()\r\n  }\r\n})\r\ndb.changes({filter: 'test/test'}).catch(function (err) {\r\n  console.log(\"this statement is never reached although an error is thrown.\")\r\n});\r\n```\r\n\r\nWhy 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."},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/69056384","html_url":"https://github.com/pouchdb/pouchdb/issues/3356#issuecomment-69056384","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3356","id":69056384,"user":{"login":"nolanlawson","id":283842,"avatar_url":"https://avatars.githubusercontent.com/u/283842?v=3","gravatar_id":"","url":"https://api.github.com/users/nolanlawson","html_url":"https://github.com/nolanlawson","followers_url":"https://api.github.com/users/nolanlawson/followers","following_url":"https://api.github.com/users/nolanlawson/following{/other_user}","gists_url":"https://api.github.com/users/nolanlawson/gists{/gist_id}","starred_url":"https://api.github.com/users/nolanlawson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nolanlawson/subscriptions","organizations_url":"https://api.github.com/users/nolanlawson/orgs","repos_url":"https://api.github.com/users/nolanlawson/repos","events_url":"https://api.github.com/users/nolanlawson/events{/privacy}","received_events_url":"https://api.github.com/users/nolanlawson/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T17:20:36Z","updated_at":"2015-01-07T17:20:36Z","body":"Ouch. Same thing happens with map/reduce functions btw."}}