Bug 33974: (QA follow-up) Remove superflous import
[koha.git] / Koha / Exceptions / Patron.pm
1 package Koha::Exceptions::Patron;
2
3 use Modern::Perl;
4
5 use Koha::Exception;
6
7 use Exception::Class (
8     'Koha::Exceptions::Patron' => {
9         isa => 'Koha::Exception',
10     },
11     'Koha::Exceptions::Patron::MissingEmailAddress' => {
12         description => "Patron has no email address",
13     },
14     'Koha::Exceptions::Patron::FailedDelete' => {
15         isa         => 'Koha::Exceptions::Patron',
16         description => "Deleting patron failed"
17     },
18     'Koha::Exceptions::Patron::FailedAnonymizing' => {
19         isa         => 'Koha::Exceptions::Patron',
20         description => "Anonymizing patron reading history failed"
21     },
22     'Koha::Exceptions::Patron::FailedDeleteAnonymousPatron' => {
23         isa         => 'Koha::Exceptions::Patron',
24         description => "Deleting patron failed, AnonymousPatron is not deleteable"
25     },
26     'Koha::Exceptions::Patron::InvalidUserid' => {
27         isa         => 'Koha::Exceptions::Patron',
28         description => 'Field userid is not valid (probably not unique)',
29         fields      => [ 'userid' ],
30     },
31     'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute' => {
32         isa         => 'Koha::Exceptions::Patron',
33         description => "Mandatory extended attribute missing",
34         fields      => ['type']
35     }
36 );
37
38 sub full_message {
39     my $self = shift;
40
41     my $msg = $self->message;
42
43     unless ( $msg) {
44         if ( $self->isa('Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute') ) {
45             $msg = sprintf("Missing mandatory extended attribute (type=%s)", $self->type );
46         }
47     }
48
49     return $msg;
50 }
51
52 =head1 NAME
53
54 Koha::Exceptions::Patron - Base class for patron exceptions
55
56 =head1 Exceptions
57
58 =head2 Koha::Exceptions::Patron
59
60 Generic patron exception.
61
62 =head2 Koha::Exceptions::Patron::FailedDelete
63
64 Deleting patron failed.
65
66 =head2 Koha::Exceptions::Patron::FailedDeleteAnonymousPatron
67
68 Tried to delete the anonymous patron.
69
70 =head2 Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute
71
72 A required mandatory extended attribute is missing.
73
74 =head1 Class methods
75
76 =head2 full_message
77
78 Overloaded method for exception stringifying.
79
80 =cut
81
82 1;