Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-3286

Validation function throwing unexpected json crashes with function_clause

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Validation function expected to throw JSON object with types forbidden or unauthorized on invalid doc. If, however, it throws valid JSON error of different error type, that leads to crash with function_clause

       http post :5984/koi answer=42
      {
          "error": "unknown_error", 
          "reason": "function_clause", 
          "ref": 3462017963
      }
      

      In logs:

      [error] 2017-01-30T18:17:51.539256Z node1@192.168.50.50 <0.1685.0> 1c86018033 rpc couch_db:update_docs/4 {case_clause,{[{<<"bad_request">>,<<"Invalid document">>}]}} [{couch_qu
      ery_servers,validate_doc_update,5,[{file,"src/couch_query_servers.erl"},{line,285}]},{couch_db,'-validate_doc_update_int/3-lc$^0/1-0-',5,[{file,"src/couch_db.erl"},{line,642}]}
      ,{couch_db,'-validate_doc_update_int/3-fun-0-',3,[{file,"src/couch_db.erl"},{line,642}]},{couch_stats,update_histogram,2,[{file,"src/couch_stats.erl"},{line,98}]},{couch_db,'-p
      rep_and_validate_updates/6-fun-1-',3,[{file,"src/couch_db.erl"},{line,736}]},{lists,foldl,3,[{file,"lists.erl"},{line,1262}]},{couch_db,prep_and_validate_updates,6,[{file,"src/
      couch_db.erl"},{line,727}]},{couch_db,update_docs,4,[{file,"src/couch_db.erl"},{line,976}]}]
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              eiri Eric Avdey
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: