# HG changeset patch # User Matti Hamalainen # Date 1454511572 -7200 # Node ID c303ddc0a68323f102a6af29d3caef1428afeb27 # Parent 26b7963e7fbda97aedd7bcb82a328f21052c6a1a fetch_weather: Don't die() in case of bad XML from FMI, just skip parsing the rest. diff -r 26b7963e7fbd -r c303ddc0a683 fetch_weather.pl --- a/fetch_weather.pl Mon Feb 01 15:34:34 2016 +0200 +++ b/fetch_weather.pl Wed Feb 03 16:59:32 2016 +0200 @@ -431,8 +431,12 @@ my @fmatches = ($fline =~ /\s*([\+\-]?\d+\.\d*|NaN)\s*/ig); if (scalar(@fmatches) > 0) { - die("Not enough items in scalar line (".scalar(@fmatches). " vs ".scalar(@fmitems). - "): ".$fline."\n") if (scalar(@fmatches) != scalar(@fmitems)); + if (scalar(@fmatches) != scalar(@fmitems)) + { + print STDERR "Not enough items in scalar line (". + scalar(@fmatches). " vs ".scalar(@fmitems)."): ".$fline."\n"; + goto skip_it; + } for (my $fni = 0; $fni < scalar(@fmitems); $fni++) { $farray[$findex]{$fmitems[$fni]} = $fmatches[$fni] if (lc($fmatches[$fni]) ne "nan"); @@ -488,6 +492,10 @@ } +### Skip here if the FMI shit fails due to broken data +skip_it: + + ### ### Purge very old entries, default to 60 minutes ###