@@ -, +, @@ exception message --- Koha/Biblio/Metadata.pm | 5 ++++- Koha/Exceptions/Metadata.pm | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) --- a/Koha/Biblio/Metadata.pm +++ a/Koha/Biblio/Metadata.pm @@ -68,11 +68,14 @@ sub record { if ( $self->format eq 'marcxml' ) { $record = eval { MARC::Record::new_from_xml( $self->metadata, 'utf-8', $self->schema ); }; + my $marcxml_error = $@; + chomp $marcxml_error; unless ($record) { Koha::Exceptions::Metadata::Invalid->throw( id => $self->id, format => $self->format, - schema => $self->schema + schema => $self->schema, + marcxml_error => $marcxml_error, ); } } --- a/Koha/Exceptions/Metadata.pm +++ a/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'] + fields => ['id','format','schema', 'marcxml_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)", - $self->id, $self->format, $self->schema ); + $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 ); } } --