A lot of different error response structures

17 views
Skip to first unread message

BrandonBaker

unread,
Oct 22, 2016, 7:20:41 PM10/22/16
to Tumblr API Discussion
I noticed I get a lot of different object structures back on errors. It makes it a little hard to do error handling. Maybe I'm missing something?

A few errors with different structures:
{"meta":{"status":400,"msg":"Bad Request"},"response":{"errors":{"state":"Can't queue more than 300 posts."}}}
{"meta":{"status":400,"msg":"Bad Request"},"response":{"errors":["Error uploading photo."]}}
{"meta":{"status":504,"msg":"Service Unavailable"},"response":"Service is temporarily unavailable. Our engineers are working quickly to resolve the issue."}
{"meta":{"status":404,"msg":"Not Found"},"response":[]}

Ideally, I would check the HTTP response code and grab the error message from the same place in the object.

Like I said, maybe I'm missing something. If anyone out there has any non-messy suggestions on how to handle all of these different structures, let me know!

Brandon
Reply all
Reply to author
Forward
0 new messages