Skip to content

Commit 050898b

Browse files
authored
Merge pull request #14 from rintisch/feature/error-message-for-google-api
Add error message for API request
2 parents e75b110 + 76a5ef1 commit 050898b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Classes/Service/GeoService.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,17 @@ protected function getApiCallResult(string $url, int $remainingTries = 10): arra
232232
{
233233
$response = GeneralUtility::getUrl($url);
234234
$result = json_decode($response, true);
235+
236+
if($result['status'] !== 'OK'){
237+
throw new \RuntimeException(
238+
sprintf(
239+
'Request to Google Maps API returned status "%s". Got following error message: "%s"',
240+
$result['status'],
241+
$result['error_message']),
242+
1621512170
243+
);
244+
}
245+
235246
if ($result['status'] !== 'OVER_QUERY_LIMIT' || $remainingTries <= 0) {
236247
return $result;
237248
}

0 commit comments

Comments
 (0)