mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
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
This commit is contained in:
parent
79f7362fe9
commit
a8cd428032
@ -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 ) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user