Issue #59: Show content on weather API error

This commit is contained in:
Dale Davies
2023-03-17 14:04:57 +00:00
parent 5afe3cc636
commit da9d357f1d
6 changed files with 31 additions and 23 deletions

View File

@@ -61,7 +61,7 @@ class Weather extends AbstractAPI {
curl_close($ch);
// If we had an error then return the error message and exit, otherwise return the API response.
if (isset($curlerror)) {
http_response_code(400);
http_response_code(curl_getinfo($ch)['http_code']);
die(json_encode(['error' => $curlerror]));
}
return $response;