jiahuili430 commented on code in PR #5556:
URL: https://github.com/apache/couchdb/pull/5556#discussion_r2126866195
##########
src/ddoc_cache/src/ddoc_cache_entry_validation_funs.erl:
##########
@@ -27,16 +27,21 @@ ddocid(_) ->
recover(DbName) ->
{ok, DDocs} = fabric:design_docs(mem3:dbname(DbName)),
- Funs = lists:flatmap(
- fun(DDoc) ->
- case couch_doc:get_validate_doc_fun(DbName, DDoc) of
- nil -> [];
- Fun -> [Fun]
- end
- end,
- DDocs
- ),
- {ok, Funs}.
+ case is_list(DDocs) of
+ true ->
+ Funs = lists:flatmap(
+ fun(DDoc) ->
+ case couch_doc:get_validate_doc_fun(DbName, DDoc) of
+ nil -> [];
+ Fun -> [Fun]
+ end
+ end,
+ DDocs
+ ),
+ {ok, Funs};
+ false ->
+ throw({error, DDocs})
Review Comment:
Changed to `error({error, DDocs})` and added some comments about why we
can't use `[]`.
--
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]