jumblr
jumblr copied to clipboard
Error parsing API error response
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
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.
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.