View | Details | Raw Unified | Return to bug 23425
Collapse All | Expand All

(-)a/Koha/Biblio/Metadata.pm (-1 / +1 lines)
Lines 75-81 sub record { Link Here
75
                id     => $self->id,
75
                id     => $self->id,
76
                format => $self->format,
76
                format => $self->format,
77
                schema => $self->schema,
77
                schema => $self->schema,
78
                marcxml_error => $marcxml_error,
78
                decoding_error => $marcxml_error,
79
            );
79
            );
80
        }
80
        }
81
    }
81
    }
(-)a/Koha/Exceptions/Metadata.pm (-3 / +3 lines)
Lines 25-31 use Exception::Class ( Link Here
25
    'Koha::Exceptions::Metadata::Invalid' => {
25
    'Koha::Exceptions::Metadata::Invalid' => {
26
        isa => 'Koha::Exceptions::Metadata',
26
        isa => 'Koha::Exceptions::Metadata',
27
        description => 'Invalid data',
27
        description => 'Invalid data',
28
        fields => ['id','format','schema', 'marcxml_error']
28
        fields => ['id','format','schema', 'decoding_error']
29
    }
29
    }
30
);
30
);
31
31
Lines 36-43 sub full_message { Link Here
36
36
37
    unless ($msg) {
37
    unless ($msg) {
38
        if ( $self->isa('Koha::Exceptions::Metadata::Invalid') ) {
38
        if ( $self->isa('Koha::Exceptions::Metadata::Invalid') ) {
39
            $msg = sprintf( "Invalid data, cannot decode object (id=%s, format=%s, schema=%s, MARCXML error='%s')",
39
            $msg = sprintf( "Invalid data, cannot decode object (id=%s, format=%s, schema=%s, decoding_error='%s')",
40
                $self->id, $self->format, $self->schema, $self->marcxml_error );
40
                $self->id, $self->format, $self->schema, $self->decoding_error );
41
        }
41
        }
42
    }
42
    }
43
43
(-)a/t/Koha/Exceptions.t (-3 / +4 lines)
Lines 115-126 subtest 'Koha::Exceptions::Metadata tests' => sub { Link Here
115
    $object->mock( 'schema', 'a_schema' );
115
    $object->mock( 'schema', 'a_schema' );
116
116
117
    throws_ok
117
    throws_ok
118
        { Koha::Exceptions::Metadata::Invalid->throw( id => 'an_id', format => 'a_format', schema => 'a_schema' ); }
118
        { Koha::Exceptions::Metadata::Invalid->throw(
119
            id => 'an_id', format => 'a_format',
120
            schema => 'a_schema', decoding_error => 'a_nasty_error' ); }
119
        'Koha::Exceptions::Metadata::Invalid',
121
        'Koha::Exceptions::Metadata::Invalid',
120
        'Exception is thrown :-D';
122
        'Exception is thrown :-D';
121
123
122
    # stringify the exception
124
    # stringify the exception
123
    is( "$@", 'Invalid data, cannot decode object (id=an_id, format=a_format, schema=a_schema)', 'Exception stringified correctly' );
125
    is( "$@", 'Invalid data, cannot decode object (id=an_id, format=a_format, schema=a_schema, decoding_error=\'a_nasty_error\')', 'Exception stringified correctly' );
124
126
125
    throws_ok
127
    throws_ok
126
        { Koha::Exceptions::Metadata::Invalid->throw( "Manual message exception" ) }
128
        { Koha::Exceptions::Metadata::Invalid->throw( "Manual message exception" ) }
127
- 

Return to bug 23425