@@ -, +, @@ --- Koha/REST/V1/Patrons/Attributes.pm | 7 ++----- t/db_dependent/api/v1/patrons_extended_attributes.t | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) --- a/Koha/REST/V1/Patrons/Attributes.pm +++ a/Koha/REST/V1/Patrons/Attributes.pm @@ -205,13 +205,10 @@ sub overwrite { openapi => { error => "$_" } ); } - elsif ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) { + elsif ( $_->isa('Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute') ) { return $c->render( status => 400, - openapi => { - error => 'Missing mandatory attribute of type "' - . $_->value . '".' - } + openapi => { error => "$_" } ); } --- a/t/db_dependent/api/v1/patrons_extended_attributes.t +++ a/t/db_dependent/api/v1/patrons_extended_attributes.t @@ -301,7 +301,7 @@ subtest 'overwrite() tests' => sub { . '/extended_attributes' => json => [ { type => $unique_attr_type->code, value => $value_1 } ] ) ->status_is(400) - ->json_is( '/error' => 'Missing mandatory attribute of type "' . $mandatory_attr_type->code . '".' ); + ->json_is( '/error' => "Missing mandatory extended attribute (type=" . $mandatory_attr_type->code . ')' ); $patron->add_extended_attribute({ code => $repeatable_attr_type->code, attribute => 'repeatable_1' }); $patron->add_extended_attribute({ code => $repeatable_attr_type->code, attribute => 'repeatable_2' }); --