jumblr icon indicating copy to clipboard operation
jumblr copied to clipboard

Error parsing API error response

Open linuxdaemon opened this issue 8 years ago • 2 comments

When the API itself returns an error, in my case, it was that the queue limit had been reached, the JumblrException class attempts to cast response.errors to a JsonArray, when it is in fact a JsonObject. Tested by building a custom version of Jumblr and adding a print line just before the cast. the response received is '{"errors":{"state":"Can't queue more than 300 posts."}}' and the relevant line is JumblrException.java:83

linuxdaemon avatar Mar 30 '16 00:03 linuxdaemon

This has caused me numerous problems in debugging errors that are not specific to the API or my code. I now have a switch in place to print the actual error as above that I have to use when I get these problems.

Linus12 avatar Sep 01 '16 23:09 Linus12

I'm finding also object arrays, eg:

{
    "meta": {
        "status": 404,
        "msg": "Not Found"
    },
    "response": [],
    "errors": [
        {
            "title": "Not Found",
            "code": 4012,
            "detail": "This Tumblr is only viewable within the Tumblr dashboard"
        }
    ]
}

In my case, I'd like to be able to distinguish between blogs that no longer exist, or ones that do exist, but are only available on the Tumblr dashboard, so switching on the error code isn't going to help.

ndtreviv avatar May 01 '19 15:05 ndtreviv