Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-5777

Saving design doc on UI should handle invalid_design_document error from server gracefully

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 2.0-beta
    • 2.0-beta
    • UI
    • Security Level: Public
    • None

    Description

      Recently design docs saving code on server side started doing javascript validation of design documents. So now when trying to save design document with syntactically invalid javascript UI fails badly with the following in logs:

      [menelaus:warn] [2012-07-03 22:59:55] [n_0@127.0.0.1:<0.509.0>:menelaus_web:loop:309] Client-side error-report for user "Administrator" on node 'n_0@127.0.0.1':
      User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5
      Browser client XHR failure encountered. (age: 955) Diagnostic info:
      s: {"url":"/couchBase/default/_design/dev_foo","isLocal":false,"global":true,"type":"PUT","contentType":"application/json","processData":true,"async":true,"accepts":

      {"xml":"application/xml, text/xml","html":"text/html","text":"text/plain","json":"application/json, text/javascript","*":"*/*","script":"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"}

      ,"contents":{"xml":{},"html":{},"json":{},"script":{}},"responseFields":

      {"xml":"responseXML","text":"responseText"}

      ,"converters":

      {"text html":true}

      ,"jsonp":"callback","timeout":30000,"cache":false,"dataType":"json","data":"{\"_id\":\"_design/dev_foo\",\"_rev\":\"1-c2a79e11\",\"views\":{\"foo1\":{\"map\":\"function (doc

      {\\n emit(doc._id, null);\\n}

      \"}}}","dataTypes":["text","json"],"crossDomain":false,"hasContent":true}
      xhrStatus: error,
      xhrReadyState: 4,
      errMsg: Bad Request,
      statusCode: 400,
      responseText:
      {"error":"invalid_design_document","reason":"Syntax error in the map function of the view `foo1': SyntaxError: Unexpected token

      {"}

      We need to add handling of this kind of error to design doc saving code and do something sensible on UI.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pavel Pavel Blagodov
            alkondratenko Aleksey Kondratenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty