From 6a78fad4e038b65eba5d39230f5b70d92ed7edcf Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 5 Aug 2013 09:28:19 -0400 Subject: [PATCH] Bug 10684: make sure that Koha search does not dies on undecodable records When a record fails to decode during a search, Koha dies with an error. Koha should ignore bad records and continue on ( and log the error ). An example of a record that Zebra will happily ingest but which MARC::Record doesn't like is one that contains a punctuation character in a tag label. Signed-off-by: Chris Cormack Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- C4/Search.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index bec1f89cd9..5b41acb358 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1699,7 +1699,10 @@ sub searchResults { # loop through all of the records we've retrieved for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { - my $marcrecord = MARC::File::USMARC::decode( $marcresults->[$i] ); + my $marcrecord = eval { MARC::File::USMARC::decode( $marcresults->[$i] ) }; + warn "ERROR DECODING RECORD - $@: " . $marcresults->[$i] if $@; + next if $@; + my $fw = $scan ? undef : $bibliotag < 10 -- 2.39.5