https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26518 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I am scared a bit. Take the following code: #!/usr/bin/perl use Modern::Perl; use Test::More tests => 1; use Koha::Database; use Koha::Cities; use Koha::Exceptions; use Try::Tiny; my $schema = Koha::Database->new->schema; subtest 'City' => sub { plan tests => 2; my $nb_cities = Koha::Cities->count; my $city_id; $city_id = add_city(); is( $city_id, undef); is( Koha::Cities->count, $nb_cities ); }; sub add_city{ my $city_id; try { $schema->txn_do(sub { $city_id = Koha::City->new({ city_name => "test" })->store->cityid; Koha::Exceptions::ObjectNotCreated->throw; }); } catch { $city_id = undef; warn $_; }; return $city_id; } => The city won't be added. Now surround $city_id = add_city(); with a transaction: $schema->storage->txn_do(sub { $city_id = add_city(); }); => The city is added. Which means that what we are doing in the "sub add_city" depends on how the caller is handling things, and that is very scary. We are going to hit very weird side-effects. -- You are receiving this mail because: You are watching all bug changes.