Bugzilla – Attachment 114794 Details for
Bug 27333
Wrong exception thrown in Koha::Club::Hold::add
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27333: Throw the right exceptions
Bug-27333-Throw-the-right-exceptions.patch (text/plain), 1.61 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-01-04 14:17:47 UTC
(
hide
)
Description:
Bug 27333: Throw the right exceptions
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-01-04 14:17:47 UTC
Size:
1.61 KB
patch
obsolete
>From 35ef864771364f97b09a4d7c793ee34c900cc84f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 4 Jan 2021 11:10:12 -0300 >Subject: [PATCH] Bug 27333: Throw the right exceptions > >If parameters are missing, we need to throw >Koha::Exceptions::MissingParameter exceptions. > >To test: >1. Apply the regression tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Club/Hold.t >=> FAIL: Tests fail because the method doesn't throw the right >exceptions >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D >--- > Koha/Club/Hold.pm | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > >diff --git a/Koha/Club/Hold.pm b/Koha/Club/Hold.pm >index df8be67de2..aaf61ac901 100644 >--- a/Koha/Club/Hold.pm >+++ b/Koha/Club/Hold.pm >@@ -26,6 +26,7 @@ use Koha::Database; > use Koha::Club::Template::Fields; > > use base qw(Koha::Object); >+use Koha::Exceptions; > use Koha::Exceptions::ClubHold; > use Koha::Club::Hold::PatronHold; > use Koha::Clubs; >@@ -54,8 +55,14 @@ Class (static) method that returns a new Koha::Club::Hold instance > sub add { > my ( $params ) = @_; > >- Koha::Exceptions::ClubHold->throw() >- unless $params->{club_id} && $params->{biblio_id}; >+ # check for mandatory params >+ my @mandatory = ( 'biblio_id', 'club_id' ); >+ for my $param (@mandatory) { >+ unless ( defined( $params->{$param} ) ) { >+ Koha::Exceptions::MissingParameter->throw( >+ error => "The $param parameter is mandatory" ); >+ } >+ } > > my $club = Koha::Clubs->find($params->{club_id}); > my @enrollments = $club->club_enrollments->as_list; >-- >2.30.0
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 27333
:
114793
|
114794
|
115827
|
115828