From cb8aaff8c380fac3b17a4ba4c31a185623b3420d 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Joonas Kylmälä Signed-off-by: Tomas Cohen Arazi --- Koha/BiblioUtils.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/BiblioUtils.pm b/Koha/BiblioUtils.pm index ebae899dc6..cb7baed0db 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.39.2