From 03d191aa9a06fbc27a040af625e4eef8393ca1f9 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 10 Dec 2018 12:02:41 +0000 Subject: [PATCH] Bug 21980: Add new excpetions 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. Signed-off-by: Tomas Cohen Arazi --- Koha/Exceptions/Account.pm | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Koha/Exceptions/Account.pm b/Koha/Exceptions/Account.pm index 5cafe5f9ab..4c2e2c3ff7 100644 --- a/Koha/Exceptions/Account.pm +++ b/Koha/Exceptions/Account.pm @@ -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; -- 2.20.0