nickva commented on code in PR #5556:
URL: https://github.com/apache/couchdb/pull/5556#discussion_r2121564784
##########
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:
Raising an error in general seems more preferable unless we have some code
somewhere already catching throws for recovery.
--
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]