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 <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Kyle M Hall 2013-08-05 09:28:19 -04:00 committed by Galen Charlton
parent 7e6364baee
commit 6a78fad4e0
1 changed files with 4 additions and 1 deletions

View File

@ -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