You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Christopher Bonhage (Created) (JIRA)" <ji...@apache.org> on 2011/11/04 01:29:32 UTC

[jira] [Created] (COUCHDB-1332) Invalid JSON shows debug level info in response

Invalid JSON shows debug level info in response
-----------------------------------------------

                 Key: COUCHDB-1332
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1332
             Project: CouchDB
          Issue Type: Improvement
          Components: HTTP Interface
    Affects Versions: 1.1.1
         Environment: OS X 10.7.1 Macbook Pro
            Reporter: Christopher Bonhage
            Priority: Minor
             Fix For: 1.1.1


When sending invalid JSON in an HTTP request, the response contains the string "invalid UTF-8 JSON: " followed by an erlang tuple and the escaped internal form of the string. I noticed that this error tuple is only logged when the [log] level is debug. I would propose that the error tuple only be show in the client response when debug is on as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1332) Invalid JSON shows debug level info in response

Posted by "Christopher Bonhage (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144303#comment-13144303 ] 

Christopher Bonhage commented on COUCHDB-1332:
----------------------------------------------

The "reason" key cannot be easily matched against, and my users are incredibly fearful of "teh codes" (erlang tuples, binaries, and cryptically useful feedback) in the error string.
This patch makes non-debug-level JSON errors more aesthetically pleasing. Ideally, the details of the parse error could be included in separate keys on the error object instead of being stringified into the reason key, but that's "nice to have", since the debug message is eminently readable to anyone who understands what escaping means. Unfortunately, they don't seem to appreciate my suggestion of simply sending valid JSON.

Example errors:

{"error":"bad_request","reason":"invalid UTF-8 JSON: {{error,{9,\"lexical error: invalid char in json text.\\n\"}},\n                     <<\"{\\\"note\\\":asd\\\"dfsdfsdfsdfsdf\\\"}\">>}"} 
 
{"error":"bad_request","reason":"invalid UTF-8 JSON: {{error,{2,\n                             \"parse error: invalid object key (must be a string)\\n\"}},\n                     <<\"{{\\\"note\\\":\\\"dsdfsdfsdfsdf\\\"}\">>}"}
                
> Invalid JSON shows debug level info in response
> -----------------------------------------------
>
>                 Key: COUCHDB-1332
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1332
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 1.1.1
>         Environment: OS X 10.7.1 Macbook Pro
>            Reporter: Christopher Bonhage
>            Priority: Minor
>              Labels: erlang, error, json
>         Attachments: COUCHDB-1332.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> When sending invalid JSON in an HTTP request, the response contains the string "invalid UTF-8 JSON: " followed by an erlang tuple and the escaped internal form of the string. I noticed that this error tuple is only logged when the [log] level is debug. I would propose that the error tuple only be show in the client response when debug is on as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (COUCHDB-1332) Invalid JSON shows debug level info in response

Posted by "Christopher Bonhage (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Bonhage resolved COUCHDB-1332.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.2
                   1.3
                   1.2

Resolved by COUCHDB-1406
                
> Invalid JSON shows debug level info in response
> -----------------------------------------------
>
>                 Key: COUCHDB-1332
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1332
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 1.1.1
>         Environment: OS X 10.7.1 Macbook Pro
>            Reporter: Christopher Bonhage
>            Priority: Minor
>              Labels: erlang, error, json
>             Fix For: 1.2, 1.3, 1.1.2
>
>         Attachments: COUCHDB-1332.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> When sending invalid JSON in an HTTP request, the response contains the string "invalid UTF-8 JSON: " followed by an erlang tuple and the escaped internal form of the string. I noticed that this error tuple is only logged when the [log] level is debug. I would propose that the error tuple only be show in the client response when debug is on as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1332) Invalid JSON shows debug level info in response

Posted by "Christopher Bonhage (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Bonhage updated COUCHDB-1332:
-----------------------------------------

    Attachment: COUCHDB-1332.patch

this patch checks to see if couch_log:debug_on and shows a simplified error message ("invalid UTF-8 JSON") if debug is off.
                
> Invalid JSON shows debug level info in response
> -----------------------------------------------
>
>                 Key: COUCHDB-1332
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1332
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 1.1.1
>         Environment: OS X 10.7.1 Macbook Pro
>            Reporter: Christopher Bonhage
>            Priority: Minor
>              Labels: erlang, error, json
>             Fix For: 1.1.1
>
>         Attachments: COUCHDB-1332.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> When sending invalid JSON in an HTTP request, the response contains the string "invalid UTF-8 JSON: " followed by an erlang tuple and the escaped internal form of the string. I noticed that this error tuple is only logged when the [log] level is debug. I would propose that the error tuple only be show in the client response when debug is on as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1332) Invalid JSON shows debug level info in response

Posted by "Robert Newson (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Newson updated COUCHDB-1332:
-----------------------------------

    Fix Version/s:     (was: 1.1.1)
    
> Invalid JSON shows debug level info in response
> -----------------------------------------------
>
>                 Key: COUCHDB-1332
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1332
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 1.1.1
>         Environment: OS X 10.7.1 Macbook Pro
>            Reporter: Christopher Bonhage
>            Priority: Minor
>              Labels: erlang, error, json
>         Attachments: COUCHDB-1332.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> When sending invalid JSON in an HTTP request, the response contains the string "invalid UTF-8 JSON: " followed by an erlang tuple and the escaped internal form of the string. I noticed that this error tuple is only logged when the [log] level is debug. I would propose that the error tuple only be show in the client response when debug is on as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1332) Invalid JSON shows debug level info in response

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Newson updated COUCHDB-1332:
-----------------------------------

    Fix Version/s:     (was: 1.1.2)

Removing 1.0.4/1.1.2.
                
> Invalid JSON shows debug level info in response
> -----------------------------------------------
>
>                 Key: COUCHDB-1332
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1332
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 1.1.1
>         Environment: OS X 10.7.1 Macbook Pro
>            Reporter: Christopher Bonhage
>            Priority: Minor
>              Labels: erlang, error, json
>             Fix For: 1.2, 1.3
>
>         Attachments: COUCHDB-1332.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> When sending invalid JSON in an HTTP request, the response contains the string "invalid UTF-8 JSON: " followed by an erlang tuple and the escaped internal form of the string. I noticed that this error tuple is only logged when the [log] level is debug. I would propose that the error tuple only be show in the client response when debug is on as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1332) Invalid JSON shows debug level info in response

Posted by "Robert Newson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143889#comment-13143889 ] 

Robert Newson commented on COUCHDB-1332:
----------------------------------------

Why?
                
> Invalid JSON shows debug level info in response
> -----------------------------------------------
>
>                 Key: COUCHDB-1332
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1332
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>    Affects Versions: 1.1.1
>         Environment: OS X 10.7.1 Macbook Pro
>            Reporter: Christopher Bonhage
>            Priority: Minor
>              Labels: erlang, error, json
>             Fix For: 1.1.1
>
>         Attachments: COUCHDB-1332.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> When sending invalid JSON in an HTTP request, the response contains the string "invalid UTF-8 JSON: " followed by an erlang tuple and the escaped internal form of the string. I noticed that this error tuple is only logged when the [log] level is debug. I would propose that the error tuple only be show in the client response when debug is on as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira