Zen and the Art of API Error Handling

Error Responses

API errors have been overhauled and follow a new, more descriptive format. This allows you to handle errors from the various storage services in a single, consistent manner.

Consistency in error handling can help you when you’re debugging errors. Because Kloudless abstracts away the details of individual cloud storage APIs, it is even more important to quickly determine where the issue lies — with Kloudless, an underlying cloud storage API or with your own application.

We’ve broken these error messages out into different types, based on where the issue occurs. For example, a 400 error is an issue with the request your application is making to Kloudless. You might get the following error message from the Kloudless API:

{"error_code": "invalid_parameters", "message": "query parameter 'q' must be a string of at least 1 character", "id": "65a856ed-fb0e-44ad-bb9f-3e649b2c969f"}

Kloudless will also pass back the original error message from the underlying cloud storage service API in addition to its own error messaging. Pretty useful!

If you see any 500 errors, this means that the issue is on the Kloudless side so please contact us and we’ll help you out! Please leave us a comment below, email us, open an issue in the relevant GitHub repository, reach out to us on Twitter @KloudlessAPI, or talk with us on IRC on FreeNode in #kloudless.

 

One thought on “Zen and the Art of API Error Handling

  1. > Kloudless will also pass back the original error message from the underlying cloud storage service API
    Sounds good. If many other API providers adopt the error handling policy, we can get crossover stack trace and detect causes easily.

What're your thoughts!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s