From 2ae6e95a40b4da7f77f241cbe941662ff773db44 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 17 Sep 2019 15:08:06 -0300 Subject: [PATCH] Bug 23425: (QA follow-up) Keep it generic Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/Biblio/Metadata.pm | 2 +- Koha/Exceptions/Metadata.pm | 6 +++--- t/Koha/Exceptions.t | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Koha/Biblio/Metadata.pm b/Koha/Biblio/Metadata.pm index bbc11d9d87..4dc99a2f3b 100644 --- a/Koha/Biblio/Metadata.pm +++ b/Koha/Biblio/Metadata.pm @@ -75,7 +75,7 @@ sub record { id => $self->id, format => $self->format, schema => $self->schema, - marcxml_error => $marcxml_error, + decoding_error => $marcxml_error, ); } } diff --git a/Koha/Exceptions/Metadata.pm b/Koha/Exceptions/Metadata.pm index 887a49e5db..3930b86d7c 100644 --- a/Koha/Exceptions/Metadata.pm +++ b/Koha/Exceptions/Metadata.pm @@ -25,7 +25,7 @@ use Exception::Class ( 'Koha::Exceptions::Metadata::Invalid' => { isa => 'Koha::Exceptions::Metadata', description => 'Invalid data', - fields => ['id','format','schema', 'marcxml_error'] + fields => ['id','format','schema', 'decoding_error'] } ); @@ -36,8 +36,8 @@ sub full_message { unless ($msg) { if ( $self->isa('Koha::Exceptions::Metadata::Invalid') ) { - $msg = sprintf( "Invalid data, cannot decode object (id=%s, format=%s, schema=%s, MARCXML error='%s')", - $self->id, $self->format, $self->schema, $self->marcxml_error ); + $msg = sprintf( "Invalid data, cannot decode object (id=%s, format=%s, schema=%s, decoding_error='%s')", + $self->id, $self->format, $self->schema, $self->decoding_error ); } } diff --git a/t/Koha/Exceptions.t b/t/Koha/Exceptions.t index a5a504e6fd..bb36df3496 100644 --- a/t/Koha/Exceptions.t +++ b/t/Koha/Exceptions.t @@ -115,12 +115,14 @@ subtest 'Koha::Exceptions::Metadata tests' => sub { $object->mock( 'schema', 'a_schema' ); throws_ok - { Koha::Exceptions::Metadata::Invalid->throw( id => 'an_id', format => 'a_format', schema => 'a_schema' ); } + { Koha::Exceptions::Metadata::Invalid->throw( + id => 'an_id', format => 'a_format', + schema => 'a_schema', decoding_error => 'a_nasty_error' ); } 'Koha::Exceptions::Metadata::Invalid', 'Exception is thrown :-D'; # stringify the exception - is( "$@", 'Invalid data, cannot decode object (id=an_id, format=a_format, schema=a_schema)', 'Exception stringified correctly' ); + is( "$@", 'Invalid data, cannot decode object (id=an_id, format=a_format, schema=a_schema, decoding_error=\'a_nasty_error\')', 'Exception stringified correctly' ); throws_ok { Koha::Exceptions::Metadata::Invalid->throw( "Manual message exception" ) } -- 2.39.5