DEV Community

Jakub
Jakub

Posted on

How to manage in React the statuses response from a Google API

Hello,

I'm writing this post as I would like to learn and understand the best way to manage Google API status responses.

Link to statuses:
https://developers.google.com/places/web-service/autocomplete#place_autocomplete_status_codes

I would like to understand what should I do to cover the statuses in the right way and how to inform a client about it.

For example:
Probably with a status ZERO_RESULTS I can show a message to the client about the result was not a success.

But what about those statuses which are more for the dev team or management to know like this:
OVER_QUERY_LIMIT

Would be good to throw an error? and to client show, a message like The service is temporarily not available?

I would like to see some example of a good way of managing those statuses in React so I can learn a good practice :)

Thank you for your help :)

Top comments (0)