Bug 27858: (follow-up) Consistency in stringified exception

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2021-03-18 12:07:00 -03:00 committed by Jonathan Druart
parent d816bad357
commit 4f3ad7112f
3 changed files with 8 additions and 8 deletions

View File

@ -32,14 +32,14 @@ sub full_message {
unless ( $msg) {
if ( $self->isa('Koha::Exceptions::Patron::Attribute::NonRepeatable') ) {
$msg = sprintf(
"Tried to add more than one non-repeatable attributes. code=%s attribute=%s",
"Tried to add more than one non-repeatable attributes. type=%s value=%s",
$self->attribute->code,
$self->attribute->attribute
);
}
elsif ( $self->isa('Koha::Exceptions::Patron::Attribute::UniqueIDConstraint') ) {
$msg = sprintf(
"Your action breaks a unique constraint on the attribute. code=%s attribute=%s",
"Your action breaks a unique constraint on the attribute. type=%s value=%s",
$self->attribute->code,
$self->attribute->attribute
);

View File

@ -220,7 +220,7 @@ subtest 'Koha::Exceptions::Patron::Attribute::* tests' => sub {
# stringify the exception
is(
"$@",
"Tried to add more than one non-repeatable attributes. code=$code attribute=$attribute",
"Tried to add more than one non-repeatable attributes. type=$code value=$attribute",
'Exception stringified correctly'
);
@ -244,7 +244,7 @@ subtest 'Koha::Exceptions::Patron::Attribute::* tests' => sub {
# stringify the exception
is(
"$@",
"Your action breaks a unique constraint on the attribute. code=$code attribute=$attribute",
"Your action breaks a unique constraint on the attribute. type=$code value=$attribute",
'Exception stringified correctly'
);

View File

@ -91,9 +91,9 @@ subtest 'store() tests' => sub {
is(
"$@",
"Tried to add more than one non-repeatable attributes. code="
"Tried to add more than one non-repeatable attributes. type="
. $attribute_type_2->{code}
. " attribute=Bar",
. " value=Bar",
'Exception stringified correctly, attribute passed correctly'
);
@ -164,9 +164,9 @@ subtest 'store() tests' => sub {
is(
"$@",
"Your action breaks a unique constraint on the attribute. code="
"Your action breaks a unique constraint on the attribute. type="
. $attribute_type_2->{code}
. " attribute=Foo",
. " value=Foo",
'Exception stringified correctly, attribute passed correctly'
);