Skip to content
Snippets Groups Projects
Commit b250814d authored by Christos Diamantis's avatar Christos Diamantis Committed by Allan Chappell
Browse files

Making more robust logging for last commit

parent 3ce83b19
No related branches found
No related tags found
No related merge requests found
......@@ -143,13 +143,21 @@ class WeatherService {
$timezonedata = simplexml_load_string($timezone->getBody()->getContents());
}
}
catch (GuzzleException $e) {
catch (ConnectException $e) {
\Drupal::logger('openweather')->error(
'Geonames api connection failed. %message',
['%message' => $e->getMessage()]
);
$timezonedata = FALSE;
}
if (empty($timezonedata)) {
\Drupal::logger('openweather')->error('Geonames api connection failed.');
catch (GuzzleException $e) {
\Drupal::logger('openweather')->error(
'Geonames api connection failed. %message',
['%message' => $e->getMessage()]
);
$timezonedata = FALSE;
}
elseif (isset($timezonedata->status)) {
if (!empty($timezonedata) && isset($timezonedata->status)) {
\Drupal::logger('openweather')->error('Geonames api returned status @status with message "@message"', [
'@status' => (string) $timezonedata->status->attributes()->value,
'@message' => (string) $timezonedata->status->attributes()->message,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment