Bug 21980: Add new exceptions for Koha::Account

He add two new exceptions here; One to be thrown when negative 'amount'
is passed into verious account methods that always expect positive
decimals and another to be thrown when a bad 'type' is passed into an
account method.

Sponsored-by: PTFS Europe
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2018-12-10 12:02:41 +00:00 committed by Nick Clemens
parent 7185a96ca6
commit 28de85db40

View file

@ -23,17 +23,26 @@ use Exception::Class (
description => 'Something went wrong!',
},
'Koha::Exceptions::Account::IsNotCredit' => {
isa => 'Koha::Exceptions::Account',
isa => 'Koha::Exceptions::Account',
description => 'Account line is not a credit'
},
'Koha::Exceptions::Account::IsNotDebit' => {
isa => 'Koha::Exceptions::Account',
isa => 'Koha::Exceptions::Account',
description => 'Account line is not a credit'
},
'Koha::Exceptions::Account::NoAvailableCredit' => {
isa => 'Koha::Exceptions::Account',
isa => 'Koha::Exceptions::Account',
description => 'No outstanding credit'
},
'Koha::Exceptions::Account::AmountNotPositive' => {
isa => 'Koha::Exceptions::Account',
description => 'Amount should be a positive decimal'
},
'Koha::Exceptions::Account::UnrecognisedType' => {
isa => 'Koha::Exceptions::Account',
description => 'Account type was not recognised'
}
);
=head1 NAME
@ -61,6 +70,15 @@ debit and it isn't.
Exception to be used when a credit has no amount outstanding and is required
to be applied to outstanding debits.
=head2 Koha::Exceptions::Account::AmountNotPositive
Exception to be used when a passed credit or debit amount is not a positive
decimal value.
=head2 Koha::Exceptions::Account::UnrecognisedType
Exception to be used when a passed credit or debit is not of a recognised type.
=cut
1;