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

(-)a/Koha/ERM/EHoldings/Title.pm (-2 / +1 lines)
Lines 137-144 sub read_file { Link Here
137
    unless ( $csv->eof() ) {
137
    unless ( $csv->eof() ) {
138
        my ( $cde, $str, $pos ) = $csv->error_diag();
138
        my ( $cde, $str, $pos ) = $csv->error_diag();
139
        my $error = $cde ? "$cde, $str, $pos" : "";
139
        my $error = $cde ? "$cde, $str, $pos" : "";
140
        warn $error if $error;
140
        Koha::Exceptions::FileNotParsed->throw( filename => $file->{filename}, error => $error );
141
        return ( $column_headers, $lines, $error );
142
    }
141
    }
143
142
144
    return ( $column_headers, $lines );
143
    return ( $column_headers, $lines );
(-)a/Koha/Exceptions.pm (+5 lines)
Lines 20-25 use Exception::Class ( Link Here
20
        description => 'File not found',
20
        description => 'File not found',
21
        fields      => ['filename'],
21
        fields      => ['filename'],
22
    },
22
    },
23
    'Koha::Exceptions::FileNotParsed' => {
24
        isa         => 'Koha::Exception',
25
        description => 'File could not be parsed',
26
        fields      => [ 'filename', 'error' ],
27
    },
23
    'Koha::Exceptions::InvalidStatus' => {
28
    'Koha::Exceptions::InvalidStatus' => {
24
        isa         => 'Koha::Exception',
29
        isa         => 'Koha::Exception',
25
        description => 'The current status is not valid in context',
30
        description => 'The current status is not valid in context',
(-)a/t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t (-5 / +3 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Test::More tests => 8;
20
use Test::More tests => 8;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
use Test::Exception;
23
24
24
use Koha::Database;
25
use Koha::Database;
25
use Koha::BackgroundJobs;
26
use Koha::BackgroundJobs;
Lines 135-144 Nature Plants,,2055-0278,2015-01,1,1,,,,https://www.nature.com/nplants,,4aaa7,,f Link Here
135
Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bbb0,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P"
136
Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bbb0,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P"
136
        )
137
        )
137
    };
138
    };
138
    warning_is {
139
139
        Koha::ERM::EHoldings::Title::read_file($file2);
140
    throws_ok { Koha::ERM::EHoldings::Title::read_file($file2); } 'Koha::Exceptions::FileNotParsed';
140
    }
141
    '2023, EIQ - QUO character not allowed, 157', 'Error message correctly reported';
142
};
141
};
143
142
144
subtest '_create_title_hash_from_line_data' => sub {
143
subtest '_create_title_hash_from_line_data' => sub {
145
- 

Return to bug 36942