diff --git a/app/models/spree/product_set.rb b/app/models/spree/product_set.rb index f96a1afc2b..4b78be91a0 100644 --- a/app/models/spree/product_set.rb +++ b/app/models/spree/product_set.rb @@ -101,6 +101,7 @@ class Spree::ProductSet < ModelSet variant.on_hand = on_hand.to_i if on_hand.present? rescue StandardError => error notify_bugsnag(error, product, variant, variant_attributes) + raise error end end diff --git a/spec/models/spree/product_set_spec.rb b/spec/models/spree/product_set_spec.rb index 397bcfe01a..3cf3a88975 100644 --- a/spec/models/spree/product_set_spec.rb +++ b/spec/models/spree/product_set_spec.rb @@ -116,11 +116,11 @@ describe Spree::ProductSet do attributes_for(:variant).merge(unit_value: nil, on_hand: 1, sku: '321') end - it 'does not create variant and notifies bugsnag without raising exception' do + it 'does not create variant and notifies bugsnag still raising the exception' do expect(Bugsnag).to receive(:notify) number_of_variants = Spree::Variant.all.size expect { product_set.save } - .not_to raise_error(StandardError) + .to raise_error(StandardError) expect(Spree::Variant.all.size).to eq number_of_variants expect(Spree::Variant.last.sku).not_to eq('321') end