Bugzilla – Attachment 178002 Details for
Bug 35246
Bad data erorrs should provide better logs for api/v1/biblios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35246: Make Koha::Biblio->to_api throw relevant exception if no biblioitem row
Bug-35246-Make-KohaBiblio-toapi-throw-relevant-exc.patch (text/plain), 1.64 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-02-13 13:03:49 UTC
(
hide
)
Description:
Bug 35246: Make Koha::Biblio->to_api throw relevant exception if no biblioitem row
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-02-13 13:03:49 UTC
Size:
1.64 KB
patch
obsolete
>From 827555281f97a6b1ba7f0bb711253e8a94645bf0 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 13 Feb 2025 13:02:00 +0000 >Subject: [PATCH] Bug 35246: Make Koha::Biblio->to_api throw relevant exception > if no biblioitem row > >--- > Koha/Biblio.pm | 7 ++++++- > Koha/Exceptions.pm | 5 +++++ > 2 files changed, 11 insertions(+), 1 deletion(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 030da1a371b..c9baa0d1540 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -1713,7 +1713,12 @@ sub to_api { > $args = defined $args ? {%$args} : {}; > delete $args->{embed}; > >- my $json_biblioitem = $self->biblioitem->to_api($args); >+ my $biblioitem = $self->biblioitem; >+ >+ Koha::Exceptions::RelatedObjectNotFound->throw( accessor => 'biblioitem', class => 'Koha::Biblioitem' ) >+ unless $biblioitem; >+ >+ my $json_biblioitem = $biblioitem->to_api($args); > return unless $json_biblioitem; > > return { %$json_biblio, %$json_biblioitem }; >diff --git a/Koha/Exceptions.pm b/Koha/Exceptions.pm >index 5166e7fb650..d308f192290 100644 >--- a/Koha/Exceptions.pm >+++ b/Koha/Exceptions.pm >@@ -37,6 +37,11 @@ use Exception::Class ( > isa => 'Koha::Exception', > description => 'The object have not been created', > }, >+ 'Koha::Exceptions::RelatedObjectNotFound' => { >+ isa => 'Koha::Exception', >+ description => 'The requested related object does not exist', >+ fields => [ 'accessor', 'class' ], >+ }, > 'Koha::Exceptions::CannotDeleteDefault' => { > isa => 'Koha::Exception', > description => 'The default value cannot be deleted' >-- >2.48.1
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 35246
:
178001
|
178002
|
178007
|
178018
|
178019
|
178173