@@ -, +, @@ --- C4/Circulation.pm | 4 +++- t/db_dependent/Circulation.t | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -3039,8 +3039,10 @@ sub AddRenewal { AND itemnumber=?" ); + eval{ $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $unseen_renewals, $lastreneweddate, $borrowernumber, $itemnumber ); - if ( $sth->err ){ + }; + if( $sth->err ){ Koha::Exceptions::Checkout::FailedRenewal->throw( error => 'Update of issue# ' . $issue->issue_id . ' failed with error: ' . $sth->errstr ); --- a/t/db_dependent/Circulation.t +++ a/t/db_dependent/Circulation.t @@ -3756,7 +3756,7 @@ subtest 'AddReturn should clear items.onloan for unissued items' => sub { subtest 'AddRenewal and AddIssuingCharge tests' => sub { - plan tests => 12; + plan tests => 13; t::lib::Mocks::mock_preference('item-level_itypes', 1); @@ -3799,6 +3799,11 @@ subtest 'AddRenewal and AddIssuingCharge tests' => sub { # Check the item out AddIssue( $patron->unblessed, $item->barcode ); + + throws_ok { + AddRenewal( $patron->borrowernumber, $item->itemnumber, $library->id, undef, {break=>"the_renewal"} ); + } 'Koha::Exceptions::Checkout::FailedRenewal', 'Exception is thrown when renewal update to issues fails'; + t::lib::Mocks::mock_preference( 'RenewalLog', 0 ); my $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } ); my %params_renewal = ( --