diff --git a/C4/Members.pm b/C4/Members.pm index f4fd79e1dc..a901a961bc 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -400,9 +400,9 @@ sub AddMember { my $category = Koha::Patron::Categories->find( $data{categorycode} ); unless ($category) { - Koha::Exceptions::BadParameter->throw( - error => 'Invalid parameter passed', - parameter => 'categorycode' + Koha::Exceptions::Object::FKConstraint->throw( + broken_fk => 'categorycode', + value => $data{categorycode}, ); } diff --git a/Koha/Exceptions.pm b/Koha/Exceptions.pm index f49a289901..72a56cc3af 100644 --- a/Koha/Exceptions.pm +++ b/Koha/Exceptions.pm @@ -1,13 +1,10 @@ package Koha::Exceptions; use Modern::Perl; +use Koha::Exceptions::Exception; use Exception::Class ( - # General exceptions - 'Koha::Exceptions::Exception' => { - description => 'Something went wrong!', - }, 'Koha::Exceptions::BadParameter' => { isa => 'Koha::Exceptions::Exception', description => 'A bad parameter was given', diff --git a/Koha/Exceptions/Object.pm b/Koha/Exceptions/Object.pm index 4cad568347..451c677c5f 100644 --- a/Koha/Exceptions/Object.pm +++ b/Koha/Exceptions/Object.pm @@ -3,9 +3,8 @@ package Koha::Exceptions::Object; use Modern::Perl; use Exception::Class ( - 'Koha::Exceptions::Object' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Object::DuplicateID' => { isa => 'Koha::Exceptions::Object', @@ -15,7 +14,7 @@ use Exception::Class ( 'Koha::Exceptions::Object::FKConstraint' => { isa => 'Koha::Exceptions::Object', description => "Foreign key constraint broken", - fields => ['broken_fk'] + fields => ['broken_fk', 'value'], }, 'Koha::Exceptions::Object::MethodNotFound' => { isa => 'Koha::Exceptions::Object',