Bug 22521: DBRev 18.12.00.055
[koha.git] / Koha / Exceptions / Account.pm
1 package Koha::Exceptions::Account;
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3 of the License, or (at your option) any later
8 # version.
9 #
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 use Modern::Perl;
19
20 use Exception::Class (
21
22     'Koha::Exceptions::Account' => {
23         description => 'Something went wrong!',
24     },
25     'Koha::Exceptions::Account::IsNotCredit' => {
26         isa         => 'Koha::Exceptions::Account',
27         description => 'Account line is not a credit'
28     },
29     'Koha::Exceptions::Account::IsNotDebit' => {
30         isa         => 'Koha::Exceptions::Account',
31         description => 'Account line is not a credit'
32     },
33     'Koha::Exceptions::Account::NoAvailableCredit' => {
34         isa         => 'Koha::Exceptions::Account',
35         description => 'No outstanding credit'
36     },
37     'Koha::Exceptions::Account::AmountNotPositive' => {
38         isa         => 'Koha::Exceptions::Account',
39         description => 'Amount should be a positive decimal'
40     },
41     'Koha::Exceptions::Account::UnrecognisedType' => {
42         isa         => 'Koha::Exceptions::Account',
43         description => 'Account type was not recognised'
44     }
45
46 );
47
48 =head1 NAME
49
50 Koha::Exceptions::Account - Base class for Account exceptions
51
52 =head1 Exceptions
53
54 =head2 Koha::Exceptions::Account
55
56 Generic Account exception
57
58 =head2 Koha::Exceptions::Account::IsNotCredit
59
60 Exception to be used when an action on an account line requires it to be a
61 credit and it isn't.
62
63 =head2 Koha::Exceptions::Account::IsNotDebit
64
65 Exception to be used when an action on an account line requires it to be a
66 debit and it isn't.
67
68 =head2 Koha::Exceptions::Account::NoAvailableCredit
69
70 Exception to be used when a credit has no amount outstanding and is required
71 to be applied to outstanding debits.
72
73 =head2 Koha::Exceptions::Account::AmountNotPositive
74
75 Exception to be used when a passed credit or debit amount is not a positive
76 decimal value.
77
78 =head2 Koha::Exceptions::Account::UnrecognisedType
79
80 Exception to be used when a passed credit or debit is not of a recognised type.
81
82 =cut
83
84 1;