nickva commented on code in PR #5424: URL: https://github.com/apache/couchdb/pull/5424#discussion_r1945240419
########## src/couch_quickjs/src/couch_quickjs_scanner_plugin.erl: ########## @@ -814,12 +814,16 @@ nouveau_add_fun(#proc{}, _) -> ok. clouseau_index_doc(#proc{} = Proc, {[_ | _]} = Doc) -> - [Fields | _] = prompt(Proc, [<<"index_doc">>, Doc]), - lists:sort(Fields). + case prompt(Proc, [<<"index_doc">>, Doc]) of + [Fields | _] -> lists:sort(Fields); + [] -> [] + end. nouveau_index_doc(#proc{} = Proc, {[_ | _]} = Doc) -> - [Fields | _] = prompt(Proc, [<<"nouveau_index_doc">>, Doc]), - lists:sort(Fields). + case prompt(Proc, [<<"nouveau_index_doc">>, Doc]) of + [Fields | _] -> lists:sort(Fields); + [] -> [] + end. Review Comment: That could work, but we only use it twice and we're sort of lucky that both nouveau and clouseau return the same shape for fields, it's not guaranteed so always be the same. It's small enough anyway, let's keep it in as is? and if we see we need to use the same pattern for other prompts we could make it a helper. -- 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: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org