|
Lines 12-33
use Exception::Class (
Link Here
|
| 12 |
'Koha::Exceptions::Patron::Attribute::InvalidType' => { |
12 |
'Koha::Exceptions::Patron::Attribute::InvalidType' => { |
| 13 |
isa => 'Koha::Exceptions::Patron::Attribute', |
13 |
isa => 'Koha::Exceptions::Patron::Attribute', |
| 14 |
description => "the passed type is invalid", |
14 |
description => "the passed type is invalid", |
| 15 |
fields => [ "type" ] |
15 |
fields => ["type"] |
| 16 |
}, |
16 |
}, |
| 17 |
'Koha::Exceptions::Patron::Attribute::NonRepeatable' => { |
17 |
'Koha::Exceptions::Patron::Attribute::NonRepeatable' => { |
| 18 |
isa => 'Koha::Exceptions::Patron::Attribute', |
18 |
isa => 'Koha::Exceptions::Patron::Attribute', |
| 19 |
description => "repeatable not set for attribute type and tried to add a new attribute for the same code", |
19 |
description => "repeatable not set for attribute type and tried to add a new attribute for the same code", |
| 20 |
fields => [ "attribute" ] |
20 |
fields => ["attribute"] |
| 21 |
}, |
21 |
}, |
| 22 |
'Koha::Exceptions::Patron::Attribute::UniqueIDConstraint' => { |
22 |
'Koha::Exceptions::Patron::Attribute::UniqueIDConstraint' => { |
| 23 |
isa => 'Koha::Exceptions::Patron::Attribute', |
23 |
isa => 'Koha::Exceptions::Patron::Attribute', |
| 24 |
description => "unique_id set for attribute type and tried to add a new with the same code and value", |
24 |
description => "unique_id set for attribute type and tried to add a new with the same code and value", |
| 25 |
fields => [ "attribute" ] |
25 |
fields => ["attribute"] |
| 26 |
}, |
26 |
}, |
| 27 |
'Koha::Exceptions::Patron::Attribute::InvalidAttributeValue' => { |
27 |
'Koha::Exceptions::Patron::Attribute::InvalidAttributeValue' => { |
| 28 |
isa => 'Koha::Exceptions::Patron::Attribute', |
28 |
isa => 'Koha::Exceptions::Patron::Attribute', |
| 29 |
description => "the passed value is invalid for attribute type", |
29 |
description => "the passed value is invalid for attribute type", |
| 30 |
fields => [ "attribute" ] |
30 |
fields => ["attribute"] |
| 31 |
} |
31 |
} |
| 32 |
); |
32 |
); |
| 33 |
|
33 |
|
|
Lines 36-63
sub full_message {
Link Here
|
| 36 |
|
36 |
|
| 37 |
my $msg = $self->message; |
37 |
my $msg = $self->message; |
| 38 |
|
38 |
|
| 39 |
unless ( $msg) { |
39 |
unless ($msg) { |
| 40 |
if ( $self->isa('Koha::Exceptions::Patron::Attribute::NonRepeatable') ) { |
40 |
if ( $self->isa('Koha::Exceptions::Patron::Attribute::NonRepeatable') ) { |
| 41 |
$msg = sprintf( |
41 |
$msg = sprintf( |
| 42 |
"Tried to add more than one non-repeatable attributes. type=%s value=%s", |
42 |
"Tried to add more than one non-repeatable attributes. type=%s value=%s", |
| 43 |
$self->attribute->code, |
43 |
$self->attribute->code, |
| 44 |
$self->attribute->attribute |
44 |
$self->attribute->attribute |
| 45 |
); |
45 |
); |
| 46 |
} |
46 |
} elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::UniqueIDConstraint') ) { |
| 47 |
elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::UniqueIDConstraint') ) { |
|
|
| 48 |
$msg = sprintf( |
47 |
$msg = sprintf( |
| 49 |
"Your action breaks a unique constraint on the attribute. type=%s value=%s", |
48 |
"Your action breaks a unique constraint on the attribute. type=%s value=%s", |
| 50 |
$self->attribute->code, |
49 |
$self->attribute->code, |
| 51 |
$self->attribute->attribute |
50 |
$self->attribute->attribute |
| 52 |
); |
51 |
); |
| 53 |
} |
52 |
} elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::InvalidType') ) { |
| 54 |
elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::InvalidType') ) { |
|
|
| 55 |
$msg = sprintf( |
53 |
$msg = sprintf( |
| 56 |
"Tried to use an invalid attribute type. type=%s", |
54 |
"Tried to use an invalid attribute type. type=%s", |
| 57 |
$self->type |
55 |
$self->type |
| 58 |
); |
56 |
); |
| 59 |
} |
57 |
} elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::InvalidAttributeValue') ) { |
| 60 |
elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::InvalidAttributeValue') ) { |
|
|
| 61 |
$msg = sprintf( |
58 |
$msg = sprintf( |
| 62 |
"Tried to use an invalid value for attribute type. type=%s value=%s", |
59 |
"Tried to use an invalid value for attribute type. type=%s value=%s", |
| 63 |
$self->attribute->code, |
60 |
$self->attribute->code, |
| 64 |
- |
|
|