SachinAgarwal1337 / google-places-api

This is a PHP wrapper for Google Places API Web Service. And is Laravel Framework friendly.
MIT License
182 stars 44 forks source link

handling ZERO_RESULTS error in textSearch #29

Closed arkhub closed 7 years ago

arkhub commented 7 years ago

When searching using textSearch for text that didn't show any result in google :

Fatal error: Uncaught SKAgarwal\GoogleApi\Exceptions\GooglePlacesApiException: Response returned with status: ZERO_RESULTS in /var/www/html/testing/vendor/skagarwal/google-places-api/src/PlacesApi.php:217 Stack trace: #0 /var/www/html/testing/vendor/skagarwal/google-places-api/src/PlacesApi.php(86): SKAgarwal\GoogleApi\PlacesApi->makeRequest('textsearch/json', Array) #1 /var/www/html/testing/search.php(8): SKAgarwal\GoogleApi\PlacesApi->textSearch('MY SEARCH QUERY...') #2 {main} thrown in /var/www/html/testing/vendor/skagarwal/google-places-api/src/PlacesApi.php on line 217

is there any way to handle the zeo result so it wont get fatal error?

SachinAgarwal1337 commented 7 years ago

@arkhub This has been fixed in new release. You won't get exception for ZERO_RESULT