From 782d2e5b0bda258dd6497711a21316c9304ecae5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 20 Jul 2022 09:02:29 +0200 Subject: [PATCH] Bug 29697: Don't crash ES reindex if a record is wrong We don't want rebuild_elasticsearch.pl to crash if a record is wrong (also fix ktd setup). Note that now the script will output an error for the problematic record, which is certainly the expected behaviour as we are doing it already for authority records. --- Koha/BiblioUtils.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/BiblioUtils.pm b/Koha/BiblioUtils.pm index ebae899dc6e..cb7baed0dbd 100644 --- a/Koha/BiblioUtils.pm +++ b/Koha/BiblioUtils.pm @@ -145,12 +145,12 @@ sub get_all_biblios_iterator { while (1) { my $row = $rs->next(); return if !$row; - my $marc = $row->metadata->record({ embed_items => 1 }); my $next = eval { + my $marc = $row->metadata->record({ embed_items => 1 }); $class->new($marc, $row->biblionumber); }; if ($@) { - warn "Something went wrong reading record for biblio $row->biblionumber: $@\n"; + warn sprintf "Something went wrong reading record for biblio %s: %s\n", $row->biblionumber, $@; next; } return $next; -- 2.25.1