@@ -, +, @@ --- C4/Members.pm | 6 +++--- Koha/Exceptions.pm | 5 +---- Koha/Exceptions/Object.pm | 5 ++--- 3 files changed, 6 insertions(+), 10 deletions(-) --- a/C4/Members.pm +++ a/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}, ); } --- a/Koha/Exceptions.pm +++ a/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', --- a/Koha/Exceptions/Object.pm +++ a/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', --