Bugzilla – Attachment 165079 Details for
Bug 36473
updatetotalissues.pl should not die on a bad record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36473: (follow-up) Additionally warn the stringified exception
Bug-36473-follow-up-Additionally-warn-the-stringif.patch (text/plain), 2.46 KB, created by
Nick Clemens (kidclamp)
on 2024-04-18 11:17:55 UTC
(
hide
)
Description:
Bug 36473: (follow-up) Additionally warn the stringified exception
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-04-18 11:17:55 UTC
Size:
2.46 KB
patch
obsolete
>From bad1dc35f4e0844c47ad349fad246995ae99f680 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 18 Apr 2024 11:17:33 +0000 >Subject: [PATCH] Bug 36473: (follow-up) Additionally warn the stringified > exception > >--- > C4/Biblio.pm | 1 + > t/db_dependent/Biblio.t | 24 +++++++++++++++++++----- > 2 files changed, 20 insertions(+), 5 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 170e9f9cd97..d9e43b7dbaa 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -3062,6 +3062,7 @@ sub UpdateTotalIssues { > if ($@) { > my $exception = $@; > $exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') ); >+ warn $exception; > warn "UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber"; > return; > } >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index c920d2a3925..e8813b78cd2 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -1026,18 +1026,32 @@ subtest 'UpdateTotalIssues on Invalid record' => sub { > plan tests => 2; > > my $return_record = Test::MockModule->new('Koha::Biblio::Metadata'); >- $return_record->mock( 'record', sub { Koha::Exceptions::Metadata::Invalid->throw() } ); >+ $return_record->mock( 'record', sub { >+ my $self = shift; >+ Koha::Exceptions::Metadata::Invalid->throw( >+ id => $self->id, >+ biblionumber => $self->biblionumber, >+ format => $self->format, >+ schema => $self->schema, >+ decoding_error => "Error goes here", >+ ); >+ } ); > >- my $biblio = $builder->build_sample_biblio; >- my $biblionumber = $biblio->biblionumber; >+ my $biblio = $builder->build_sample_biblio; >+ my $biblionumber = $biblio->biblionumber; >+ my $biblio_metadata_id = $biblio->metadata->id; > > my $increase = 1; > > my $success; >- warning_is { >+ warnings_like { > $success = C4::Biblio::UpdateTotalIssues( $biblio->biblionumber, $increase, '' ); > } >- "UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber", "Expected warning found"; >+ [ >+ qr/Invalid data, cannot decode metadata object/, >+ qr/UpdateTotalIssues could not get bibliographic record for biblionumber $biblionumber/ >+ ], >+ "Expected warning found"; > > ok( !$success, 'UpdateTotalIssues fails gracefully for invalid record' ); > >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36473
:
164192
|
164247
|
164269
|
164270
|
164271
|
164289
|
164290
|
164458
|
164459
|
164805
|
164806
|
165039
|
165077
|
165078
| 165079