Github user iilyak commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/81#discussion_r36312190
  
    --- Diff: src/couch_httpd.erl ---
    @@ -872,7 +872,7 @@ error_info({bad_ctype, Reason}) ->
         {415, <<"bad_content_type">>, Reason};
     error_info(requested_range_not_satisfiable) ->
         {416, <<"requested_range_not_satisfiable">>, <<"Requested range not 
satisfiable">>};
    -error_info({error, illegal_database_name, Name}) ->
    +error_info({error, {illegal_database_name, Name}}) ->
    --- End diff --
    
    This is hard to accomplish. Because of 
[this](https://github.com/cloudant/couchdb-couch/blob/epi_hooks/src/couch_db_plugin.erl#L32).
 `couch_epi:any` would succeed when any of the plugins would return `true`. So 
there is no way to inject custom error message. Since for next plugin the same 
dbname could be valid. I can see two ways to do custom messages. None of them 
perfect.
    1. `throw({illegal_database_name, DbName, Msg})` and handle this error in 
`chttpd_plugin:handle_error` handler in your plugin. 
    2. Re-implement couch_db_plugin:validate_dbname to return list of `{true, 
""} | {false, Error}`. If there are no `true` value in the list concatenate 
error messages. 
    3. Implement `couch_db_plugin:invalid_database_message/2` hook.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to