Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion share/server/nouveau.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var Nouveau = (function () {
} else if (err[0] == "fatal") {
throw (err);
}
var message = "function raised exception " + err.toSource();
var message = "function raised exception " + errstr(err);
if (doc) message += " with doc._id " + doc._id;
log(message);
};
Expand Down
1 change: 1 addition & 0 deletions test/elixir/test/config/nouveau.elixir
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"purge with conflicts",
"index same field with different field types",
"index not found",
"index function throws",
"meta",
"stale search"
]
Expand Down
24 changes: 24 additions & 0 deletions test/elixir/test/nouveau_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,30 @@ defmodule NouveauTest do
assert_status_code(resp, 404)
end

@tag :with_db
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

@tag :with_db
test "meta", context do
db_name = context[:db_name]
Expand Down