Skip to content

Commit 732886e

Browse files
committed
Show API error messages
1 parent c2f1e98 commit 732886e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Geocoder/Provider/GoogleMaps.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Geocoder\Provider;
1212

13+
use Exception;
1314
use Geocoder\Exception\InvalidCredentials;
1415
use Geocoder\Exception\NoResult;
1516
use Geocoder\Exception\QuotaExceeded;
@@ -157,6 +158,11 @@ private function executeQuery($query)
157158
throw new InvalidCredentials(sprintf('API key is invalid %s', $query));
158159
}
159160

161+
if ('REQUEST_DENIED' === $json->status) {
162+
throw new Exception(sprintf('API access denied. Request: %s - Message: %s',
163+
$query, $json->error_message));
164+
}
165+
160166
// you are over your quota
161167
if ('OVER_QUERY_LIMIT' === $json->status) {
162168
throw new QuotaExceeded(sprintf('Daily quota exceeded %s', $query));

0 commit comments

Comments
 (0)