Bug 29894: Send a confirmation notice
[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::FailedDeleteAnonymousPatron' => {
19         isa         => 'Koha::Exceptions::Patron',
20         description => "Deleting patron failed, AnonymousPatron is not deleteable"
21     },
22     'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute' => {
23         isa         => 'Koha::Exceptions::Patron',
24         description => "Mandatory extended attribute missing",
25         fields      => ['type']
26     }
27 );
28
29 sub full_message {
30     my $self = shift;
31
32     my $msg = $self->message;
33
34     unless ( $msg) {
35         if ( $self->isa('Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute') ) {
36             $msg = sprintf("Missing mandatory extended attribute (type=%s)", $self->type );
37         }
38     }
39
40     return $msg;
41 }
42
43 =head1 NAME
44
45 Koha::Exceptions::Patron - Base class for patron exceptions
46
47 =head1 Exceptions
48
49 =head2 Koha::Exceptions::Patron
50
51 Generic patron exception.
52
53 =head2 Koha::Exceptions::Patron::FailedDelete
54
55 Deleting patron failed.
56
57 =head2 Koha::Exceptions::Patron::FailedDeleteAnonymousPatron
58
59 Tried to delete the anonymous patron.
60
61 =head2 Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute
62
63 A required mandatory extended attribute is missing.
64
65 =head1 Class methods
66
67 =head2 full_message
68
69 Overloaded method for exception stringifying.
70
71 =cut
72
73 1;