View | Details | Raw Unified | Return to bug 29857
Collapse All | Expand All

(-)a/Koha/Exception.pm (-5 / +9 lines)
Lines 18-29 package Koha::Exception; Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Exception::Class qw();
21
22
22
use Exception::Class (
23
INIT { __PACKAGE__->load; }
23
    'Koha::Exception' => {
24
24
        description => "Something went wrong!"
25
sub load {
25
    },
26
    my ( $class, @exceptions ) = @_;
26
);
27
    push @exceptions, 'Koha::Exception' => { description => "Something went wrong!" }
28
        unless @exceptions;
29
    Exception::Class->import(@exceptions);
30
}
27
31
28
sub full_message {
32
sub full_message {
29
    my $self = shift;
33
    my $self = shift;
(-)a/Koha/Exception/Generic.pm (-1 / +82 lines)
Line 0 Link Here
0
- 
1
package Koha::Exception::Generic;
2
3
use Modern::Perl;
4
use parent qw(Koha::Exception);
5
6
my @exceptions;
7
INIT { __PACKAGE__->load( @exceptions ); }
8
9
@exceptions = (
10
    'Koha::Exception::BadParameter' => {
11
        isa => 'Koha::Exception',
12
        description => 'A bad parameter was given',
13
        fields => ['parameter'],
14
    },
15
    'Koha::Exception::DuplicateObject' => {
16
        isa => 'Koha::Exception',
17
        description => 'Same object already exists',
18
    },
19
    'Koha::Exception::ObjectNotFound' => {
20
        isa => 'Koha::Exception',
21
        description => 'The required object doesn\'t exist',
22
    },
23
    'Koha::Exception::ObjectNotCreated' => {
24
        isa => 'Koha::Exception',
25
        description => 'The object have not been created',
26
    },
27
    'Koha::Exception::CannotDeleteDefault' => {
28
        isa => 'Koha::Exception',
29
        description => 'The default value cannot be deleted'
30
    },
31
    'Koha::Exception::MissingParameter' => {
32
        isa => 'Koha::Exception',
33
        description => 'A required parameter is missing'
34
    },
35
    'Koha::Exception::ParameterTooHigh' => {
36
        isa => 'Koha::Exception',
37
        description => 'A passed parameter value is too high'
38
    },
39
    'Koha::Exception::NoChanges' => {
40
        isa => 'Koha::Exception',
41
        description => 'No changes were made',
42
    },
43
    'Koha::Exception::WrongParameter' => {
44
        isa => 'Koha::Exception',
45
        description => 'One or more parameters are wrong',
46
    },
47
    'Koha::Exception::NoPermission' => {
48
        isa => 'Koha::Exception',
49
        description => 'You do not have permission for this action',
50
    },
51
    'Koha::Exception::CannotAddLibraryLimit' => {
52
        isa => 'Koha::Exception',
53
        description => 'General problem adding a library limit'
54
    },
55
    'Koha::Exception::UnderMaintenance' => {
56
        isa => 'Koha::Exception',
57
        description => 'Koha is under maintenance.'
58
    },
59
    # Virtualshelves exceptions
60
    'Koha::Exception::Virtualshelves::DuplicateObject' => {
61
        isa => 'Koha::Exception::DuplicateObject',
62
        description => "Duplicate shelf object",
63
    },
64
    'Koha::Exception::Virtualshelves::InvalidInviteKey' => {
65
        isa => 'Koha::Exception',
66
        description => 'Invalid key on accepting the share',
67
    },
68
    'Koha::Exception::Virtualshelves::InvalidKeyOnSharing' => {
69
        isa => 'Koha::Exception',
70
        description=> 'Invalid key on sharing a shelf',
71
    },
72
    'Koha::Exception::Virtualshelves::ShareHasExpired' => {
73
        isa => 'Koha::Exception',
74
        description=> 'Cannot share this shelf, the share has expired',
75
    },
76
    'Koha::Exception::Virtualshelves::UseDbAdminAccount' => {
77
        isa => 'Koha::Exception',
78
        description => "Invalid use of database administrator account",
79
    }
80
);
81
82
1;

Return to bug 29857