nickva commented on PR #5951: URL: https://github.com/apache/couchdb/pull/5951#issuecomment-4157719767
Thanks for your contribution, @vamsi2246 Please fill out the PR template. Coincidentally, there is a parallel discussion in another PR https://github.com/apache/couchdb/pull/5943#pullrequestreview-4023777791 about how `errstr` can be improved. It's great to see a lot of activity and interest in improving js dispatching CouchDB! Wonder if we could cover this case by a test. It should be enough just to copy and paste a test from nouveau Elixir test and make it throw, like so: ```elixir test "index function throws", context do db_name = context[:db_name] create_search_docs(db_name) ddoc = %{ nouveau: %{ bar: %{ default_analyzer: "standard", index: """ function (doc) { throw(new Error("some error")); index("string", "foo", doc.foo, {store: true}); } """ } } } create_ddoc(db_name, ddoc) url = "/#{db_name}/_design/foo/_nouveau/bar" resp = Couch.post(url, body: %{q: "foo:bar", include_docs: true}) assert_status_code(resp, 200) assert resp.body["hits"] == [] end ``` Currently with QuickJS it should blow up with a 500 response and some ugly looking stacktrace. With this fix it should 1) return a 200 response 2) return no hits, 3) hopefully log something like "OS Process ... function raised ...". I don't think we can check for that in elixir but we hopefully will log locally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
