From a8cd4280324353bf4dc748fe0997fd6430348c69 Mon Sep 17 00:00:00 2001 From: borisneubert Date: Sun, 22 Nov 2009 16:07:31 +0000 Subject: [PATCH] Included exception handling in 59_Weather.pm to avoid crashes propagated from Weather::Google.pm. git-svn-id: https://svn.fhem.de/fhem/trunk@483 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/59_Weather.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/59_Weather.pm b/fhem/FHEM/59_Weather.pm index 0593aa519..280b76e2a 100755 --- a/fhem/FHEM/59_Weather.pm +++ b/fhem/FHEM/59_Weather.pm @@ -84,9 +84,15 @@ sub Weather_GetUpdate($) # see http://search.cpan.org/~possum/Weather-Google-0.03/lib/Weather/Google.pm my $location= $hash->{LOCATION}; - my $WeatherObj= new Weather::Google($location); - + my $WeatherObj; Log 4, "$name: Updating weather information for $location."; + eval { + $WeatherObj= new Weather::Google($location); + }; + if($@) { + Log 1, "$name: Could not retrieve weather information."; + return 0; + } my $current = $WeatherObj->current_conditions; foreach my $condition ( keys ( %$current ) ) {