You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2020/03/27 15:30:38 UTC

[couchdb] 01/01: Return a 400 error code for an invalid update sequence

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch return-400-for-invalid-seq
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0f838aa121a7b6d65506d4fb35e7a1d66420b5e5
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Fri Mar 27 11:29:20 2020 -0400

    Return a 400 error code for an invalid update sequence
    
    Currently we return a 500 but a 400 return code makes more sense
    
    ```
    $
    http  $DB1/db1/_changes?since=0-1345
    
    HTTP/1.1 400 Bad Request
    
    {
        "error": "invalid_since_seq",
        "reason": "0-1345",
        "ref": 442671026
    }
    ```
---
 src/chttpd/src/chttpd.erl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index 5984361..2641007 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -943,6 +943,8 @@ error_info({error, {database_name_too_long, DbName}}) ->
         <<"At least one path segment of `", DbName/binary, "` is too long.">>};
 error_info({doc_validation, Reason}) ->
     {400, <<"doc_validation">>, Reason};
+error_info({invalid_since_seq, Reason}) ->
+    {400, <<"invalid_since_seq">>, Reason};
 error_info({missing_stub, Reason}) ->
     {412, <<"missing_stub">>, Reason};
 error_info(request_entity_too_large) ->