diff --git a/Gemfile.lock b/Gemfile.lock index 613dd01..03658d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - umbrellio-utils (1.5.3) + umbrellio-utils (1.5.4) memery (~> 1) GEM diff --git a/lib/umbrellio_utils/control.rb b/lib/umbrellio_utils/control.rb index 348dddc..62eb82a 100644 --- a/lib/umbrellio_utils/control.rb +++ b/lib/umbrellio_utils/control.rb @@ -24,7 +24,13 @@ def retry_on_unique_violation( checked_constraints: [], &block ) - return yield if !retry_on_all_constraints && checked_constraints.empty? + if !retry_on_all_constraints && checked_constraints.empty? + begin + return yield + rescue Sequel::UniqueConstraintViolation => e + raise UniqueConstraintViolation, e.message + end + end retry_on(Sequel::UniqueConstraintViolation, times:) do DB.transaction(savepoint: true, &block) diff --git a/lib/umbrellio_utils/version.rb b/lib/umbrellio_utils/version.rb index 63999dc..8c1845b 100644 --- a/lib/umbrellio_utils/version.rb +++ b/lib/umbrellio_utils/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module UmbrellioUtils - VERSION = "1.5.3" + VERSION = "1.5.4" end