Included exception handling in 59_Weather.pm to avoid crashes propagated from Weather::Google.pm.
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@483 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -84,9 +84,15 @@ sub Weather_GetUpdate($)
|
|||||||
# see http://search.cpan.org/~possum/Weather-Google-0.03/lib/Weather/Google.pm
|
# see http://search.cpan.org/~possum/Weather-Google-0.03/lib/Weather/Google.pm
|
||||||
|
|
||||||
my $location= $hash->{LOCATION};
|
my $location= $hash->{LOCATION};
|
||||||
my $WeatherObj= new Weather::Google($location);
|
my $WeatherObj;
|
||||||
|
|
||||||
Log 4, "$name: Updating weather information for $location.";
|
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;
|
my $current = $WeatherObj->current_conditions;
|
||||||
foreach my $condition ( keys ( %$current ) ) {
|
foreach my $condition ( keys ( %$current ) ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user