1 package Koha::Exceptions::Patron::Attribute;
7 'Koha::Exceptions::Patron::Attribute' => {
8 description => 'Something went wrong'
10 'Koha::Exceptions::Patron::Attribute::InvalidType' => {
11 isa => 'Koha::Exceptions::Patron::Attribute',
12 description => "the passed type is invalid",
15 'Koha::Exceptions::Patron::Attribute::NonRepeatable' => {
16 isa => 'Koha::Exceptions::Patron::Attribute',
17 description => "repeatable not set for attribute type and tried to add a new attribute for the same code",
18 fields => [ "attribute" ]
20 'Koha::Exceptions::Patron::Attribute::UniqueIDConstraint' => {
21 isa => 'Koha::Exceptions::Patron::Attribute',
22 description => "unique_id set for attribute type and tried to add a new with the same code and value",
23 fields => [ "attribute" ]
30 my $msg = $self->message;
33 if ( $self->isa('Koha::Exceptions::Patron::Attribute::NonRepeatable') ) {
35 "Tried to add more than one non-repeatable attributes. type=%s value=%s",
36 $self->attribute->code,
37 $self->attribute->attribute
40 elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::UniqueIDConstraint') ) {
42 "Your action breaks a unique constraint on the attribute. type=%s value=%s",
43 $self->attribute->code,
44 $self->attribute->attribute
47 elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::InvalidType') ) {
49 "Tried to use an invalid attribute type. type=%s",
60 Koha::Exceptions::Patron::Attribute - Base class for patron attribute exceptions
64 =head2 Koha::Exceptions::Patron::Attribute
66 Generic patron attribute exception
68 =head2 Koha::Exceptions::Patron::Attribute::NonRepeatable
70 Exception to be used trying to add more than one non-repeatable attribute.
72 =head2 Koha::Exceptions::Patron::Attribute::UniqueIDConstraint
74 Exception to be used when trying to add an attribute that breaks its type unique constraint.
80 Overloaded method for exception stringifying.