https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871

--- Comment #5 from Marcel de Rooy <[email protected]> ---
Doing something wrong helps you find bugs :)

batchMod works with a nested try/catch construction:

First the worker calls Koha/BackgroundJob/BatchUpdateItem.pm doing
    try {
        my ($results) = Koha::Items->search( { itemnumber => \@record_ids }
)->batch_update(
etc
    } catch {
        warn $_;
        die "Something terrible has happened!"
            if ( $_ =~ /Rollback failed/ );    # Rollback failed

And batch_update does this
        try {
            $schema->txn_do(
                sub {
[etc]
$item->set($new_values)->store( { skip_record_index => 1 } );
[etc]
        } catch {
            push @errors, {
                error => eval { $_->{error} } || "$_",
            };
            warn $_
Note here that the catch does not die or raise an exception! I found the error
in worker-output.log:
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Column 'enumchron' cannot be null at
/usr/share/koha/Koha/Object.pm line 174
This error was raised by doing something wrong but that does not matter here.
The point is that the inner try block only warns in the catch. So the outer try
block does not catch anything! The error is just silently ignored.
I just got back: No items modified.

Note that this error should have its own new report. Will open one.

What did I do wrong btw? I tested my follow-up with withdrawn and enumchron.
First I tested if enumchron was blanked with NULL. That was ok. Then I just
altered the table items with enumchron NOT NULL and hoped to see that it would
be empty string. Forgetting that I am asking DBIx if it is nullable, so DBIx
had not changed and said Go ahead. Etc etc.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to