couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxepal <...@git.apache.org>
Subject [GitHub] couchdb-couch pull request: Validate document update stats
Date Sat, 01 Nov 2014 16:17:27 GMT
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/13#discussion_r19705169
  
    --- Diff: src/couch_query_servers.erl ---
    @@ -260,15 +260,27 @@ get_number(Key, Props) ->
     validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) ->
         JsonEditDoc = couch_doc:to_json_obj(EditDoc, [revs]),
         JsonDiskDoc = json_doc(DiskDoc),
    -    case ddoc_prompt(DDoc, [<<"validate_doc_update">>], [JsonEditDoc, JsonDiskDoc,
Ctx, SecObj]) of
    +    Resp = ddoc_prompt(DDoc,
    +                       [<<"validate_doc_update">>],
    +                       [JsonEditDoc, JsonDiskDoc, Ctx, SecObj]),
    +    case Resp of
             1 ->
                 ok;
    -        {[{<<"forbidden">>, Message}]} ->
    -            throw({forbidden, Message});
    -        {[{<<"unauthorized">>, Message}]} ->
    -            throw({unauthorized, Message});
    -        Message when is_binary(Message) ->
    -            throw({unknown_error, Message})
    +        Else ->
    --- End diff --
    
    Not sure I follow, but do you suggest to add another case before `case Resp of` like:
    ```
    case Resp of
      _ when Resp /= 1 -> couch_stats:increment_counter([couchdb, query_server, vdu_rejects],
1)
    end,
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message