Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spree::Core::GatewayError not caught by Spree::CheckoutController #3851

Closed
jdurand opened this issue Oct 9, 2013 · 14 comments
Closed

Spree::Core::GatewayError not caught by Spree::CheckoutController #3851

jdurand opened this issue Oct 9, 2013 · 14 comments

Comments

@jdurand
Copy link
Contributor

jdurand commented Oct 9, 2013

Using Spree v2.0.5,
Even if this is in Spree::CheckoutController :

rescue_from Spree::Core::GatewayError, :with => :rescue_from_spree_gateway_error

I get Spree::Core::GatewayError thrown when entering a wrong credit card verification number using Spree::Gateway::BraintreeGateway

I had to wrap @order.update_attributes in a begin/rescue block in order to catch the exception :

Spree::CheckoutController.class_eval do
  def update
    begin
      if @order.update_attributes(object_params)
        fire_event('spree.checkout.update')

        unless @order.next
          flash[:error] = @order.errors.full_messages.join("\n")
          redirect_to checkout_state_path(@order.state) and return
        end

        if @order.completed?
          session[:order_id] = nil
          flash.notice = Spree.t(:order_processed_successfully)
          flash[:commerce_tracking] = "nothing special"
          redirect_to completion_route
        else
          redirect_to checkout_state_path(@order.state)
        end
      else
        render :edit
      end
    rescue Spree::Core::GatewayError => e
      rescue_from_spree_gateway_error
    end
  end
end

Am I missing something?

@radar
Copy link
Contributor

radar commented Oct 9, 2013

Please provide exact steps to reproduce this problem, as well as the other info from spree https://github.com/spree/spree/tree/master/CONTRIBUTING.md.

On Thu, Oct 10, 2013 at 7:18 AM, Jim notifications@github.com wrote:

Using Spree v2.0.5,
Even if this is in Spree::CheckoutController :
rescue_from Spree::Core::GatewayError, :with => :rescue_from_spree_gateway_error
I get Spree::Core::GatewayError thrown when entering a wrong credit card verification number using Spree::Gateway::BraintreeGateway
I had to wrap @order.update_attributes in a begin/rescue block in order to catch the exception :
Spree::CheckoutController.class_eval do
def update
begin
if @order.update_attributes(object_params)
fire_event('spree.checkout.update')

        unless @order.next
          flash[:error] = @order.errors.full_messages.join("\n")
          redirect_to checkout_state_path(@order.state) and return
        end

        if @order.completed?
          session[:order_id] = nil
          flash.notice = Spree.t(:order_processed_successfully)
          flash[:commerce_tracking] = "nothing special"
          redirect_to completion_route
        else
          redirect_to checkout_state_path(@order.state)
        end
      else
        render :edit
      end
    rescue Spree::Core::GatewayError => e
      rescue_from_spree_gateway_error
    end
  end
end

Am I missing something?

Reply to this email directly or view it on GitHub:
#3851

@jdurand
Copy link
Contributor Author

jdurand commented Oct 10, 2013

Configure

    gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-0-stable'
  • Use Spree::Gateway::BraintreeGateway as your payment
    • Admin > Configuration > Payment Methods > New payment method
    • Select Spree::Gateway::BraintreeGateway from the list of providers
    • Update your payment method info with the info provided on your Braintree sandbox account
    • Set the right environment (probably development)
    • Set the payment method to active

Test

  • Add a product to your cart
  • Proceed to checkout
  • Select your new payment method
  • Enter a valid test credit card number (4111111111111111)
  • Enter an invalid CCV number (12345)
  • Click continue

You will see this uncatched exception :

Error: Spree::Core::GatewayError
Message:

CVV must be 4 digits for American Express and 3 digits for other card types. (81707)
Stacktrace
/Users/jim/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-1a91d0719e6b/core/app/models/spree/payment/processing.rb:191:in `gateway_error'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree_gateway-8ab2c6426088/app/models/spree/gateway/braintree_gateway.rb:54:in `create_profile'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-1a91d0719e6b/core/app/models/spree/payment.rb:140:in `create_payment_profile'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:449:in `_run__2560897947213726001__save__3509382149026320109__callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/callbacks.rb:264:in `create_or_update'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/persistence.rb:84:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/validations.rb:50:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:259:in `block in save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:258:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:483:in `block in save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block (2 levels) in around_save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:150:in `block in run_actions'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:170:in `catch_exceptions'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:148:in `run_actions'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:133:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:212:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block (2 levels) in perform'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `catch'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block in perform'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:186:in `within_transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:62:in `perform'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block in around_save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:530:in `block in transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:529:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:501:in `around_save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:483:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/associations/has_many_association.rb:16:in `insert_record'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:348:in `block in save_collection_association'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:341:in `each'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:341:in `save_collection_association'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:191:in `block in add_autosave_association_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:161:in `instance_eval'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:161:in `block in define_non_cyclic_method'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:421:in `_run__175287402408904942__update__3509382149026320109__callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_update_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/callbacks.rb:272:in `update'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/persistence.rb:348:in `create_or_update'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/callbacks.rb:264:in `block in create_or_update'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:458:in `_run__175287402408904942__save__3509382149026320109__callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/callbacks.rb:264:in `create_or_update'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/persistence.rb:84:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/validations.rb:50:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:259:in `block in save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:258:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:483:in `block in save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block (2 levels) in around_save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:150:in `block in run_actions'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:170:in `catch_exceptions'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:148:in `run_actions'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:133:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:212:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block (2 levels) in perform'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `catch'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block in perform'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:186:in `within_transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:62:in `perform'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block in around_save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:530:in `block in transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:529:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:501:in `around_save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:483:in `save'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/persistence.rb:217:in `block in update_attributes'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/persistence.rb:215:in `update_attributes'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-1a91d0719e6b/frontend/app/controllers/spree/checkout_controller.rb:28:in `update'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/abstract_controller/base.rb:167:in `process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal/rendering.rb:10:in `process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:645:in `_run__1038623434790008316__process_action__1219647575952504917__callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/abstract_controller/callbacks.rb:17:in `process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal/rescue.rb:29:in `process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `block in instrument'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/notifications.rb:123:in `instrument'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/abstract_controller/base.rb:121:in `process'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/abstract_controller/rendering.rb:45:in `process'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal.rb:203:in `dispatch'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_controller/metal.rb:246:in `block in action'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/routing/route_set.rb:73:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/routing/route_set.rb:36:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/routing/route_set.rb:608:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/engine.rb:484:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/routing/route_set.rb:608:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/conditionalget.rb:35:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/head.rb:14:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/flash.rb:242:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/cookies.rb:341:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/query_cache.rb:64:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `_run__1433038668348767900__call__3509382149026320109__callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/reloader.rb:65:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/rack/logger.rb:32:in `call_app'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/rack/logger.rb:16:in `block in call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/tagged_logging.rb:22:in `tagged'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/rack/logger.rb:16:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/quiet_assets-1.0.2/lib/quiet_assets.rb:18:in `call_with_quiet_assets'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/static.rb:63:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/static.rb:63:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/static.rb:63:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/static.rb:63:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-3.2.14/lib/action_dispatch/middleware/static.rb:63:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/engine.rb:484:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/application.rb:231:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.14/lib/rails/rack/log_tailer.rb:17:in `call'
/Users/jim/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/Users/jim/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/Users/jim/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/Users/jim/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

Using Spree 2.0.5 & Rails 3.2.14

Gemfile :

source 'https://rubygems.org'

gem 'rails', '3.2.14'

# Gems used only for assets and not required
# in production environments by default.

gem 'uglifier', '>= 1.0.3'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  gem 'jquery-validation-rails'
  gem 'uglifier', '>= 1.0.3'
  gem 'asset_sync'
  gem 'turbo-sprockets-rails3'
end

# Gems used only for development
group :development, :test do

  # Database
  gem 'sqlite3'

  # Debug stuff
  gem 'debugger'

  # Test suites
  gem 'rspec-rails'
  # gem 'cucumber'

  # Deployment
  gem 'capistrano'
  gem 'capistrano-ext'
  gem 'rvm-capistrano'
  # gem 'capistrano-notifier'
  gem 'capistrano-notifier', :git => 'git://github.com/jdurand/capistrano-notifier.git'

  # Turn off assets logging
  gem 'quiet_assets'
end

group :production do
  gem 'therubyracer'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# App server
gem 'puma'

# XML parser
gem 'nokogiri'

# PDF generator
gem 'prawn_rails'

# ICS generator
gem 'icalendar'

# SFTP
gem 'net-sftp'

# DB
gem 'mysql2'
gem 'yaml_db'

# Rake task input
gem 'highline'

# Caching
gem 'redis-rails'

# Twitter
gem 'twitter'

# CMS engine
gem 'browsercms', :git => 'git://github.com/jdurand/browsercms.git', :branch => '3.5.x'

# Shoping Cart engine
gem 'spree', :git => "git://github.com/jdurand/spree.git", :branch => "2-0-stable"
gem 'spree_auth_devise', :git => 'git://github.com/jdurand/spree_auth_devise.git', :branch => '2-0-stable'
gem 'spree_minicart', :git => 'git://github.com/jdurand/spree_minicart.git', :branch => '2-0-stable'
gem 'spree_i18n', :git => 'git://github.com/jdurand/spree_i18n.git', :branch => '2-0-stable'

gem 'spree_wishlist', :git => 'git://github.com/spree/spree_wishlist.git', :branch => '2-0-stable'
gem 'spree_related_products', :git => 'git://github.com/spree/spree_related_products.git', :branch => '2-0-stable'
gem 'spree_static_content', :github => 'spree/spree_static_content', :branch => '2-0-stable'
gem 'spree_address_book', :git => 'git://github.com/jdurand/spree_address_book.git', :branch => '2-0-stable'

gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-0-stable'
gem 'braintree'

# Authetication engine
gem 'devise'

# BroswerCMS Modules
gem "bcms_settings", :git => 'git://github.com/jdurand/bcms_settings.git'
gem "bcms_content_syncing"
gem "bcms_blog", :git => "git://github.com/jdurand/bcms_blog.git", :branch => "master"

gem "bcms_aws_s3"

# i18n
gem 'rails-i18n'

I get the issue, it's pretty straightforward, but I don't get why the exception is not caught by Spree::CheckoutController with rescue_from Spree::Core::GatewayError

@jdurand jdurand closed this as completed Oct 10, 2013
@jdurand jdurand reopened this Oct 10, 2013
@radar
Copy link
Contributor

radar commented Oct 11, 2013

I'm going to see if I can reproduce this problem now.

@radar
Copy link
Contributor

radar commented Oct 11, 2013

Yes, I have been able to reproduce this issue. Even better than that, the fix is only a couple of lines. I've got it over in my fork on 2-0-stable, 2-1-stable and master. Once CI says it's happy, it'll be going into spree/spree and will be out in the new releases of Spree whenever we do them.

Thanks for reporting this!

@jdurand
Copy link
Contributor Author

jdurand commented Oct 11, 2013

Happy I could help!

@radar radar closed this as completed in 9adfd0f Oct 11, 2013
radar added a commit that referenced this issue Oct 11, 2013
This makes the error messages when payments fail slightly less vague than they used to be.

Fixes #3851
radar added a commit that referenced this issue Oct 11, 2013
This makes the error messages when payments fail slightly less vague than they used to be.

Fixes #3851
@jdurand
Copy link
Contributor Author

jdurand commented Oct 11, 2013

This didn't fix it for me. I still get an Error thrown in my face.
When you said you reproduced the issue, did you get an error thrown or did you just not get the error displayed?

My installation of Spree is mounted under /shop if that helps.

Anyway, for now I'm just going to let the whole content of the update method in a begin/rescue block

@radar
Copy link
Contributor

radar commented Oct 11, 2013

I got an error thrown:

screen shot 2013-10-11 at 3 27 49 pm

@radar
Copy link
Contributor

radar commented Oct 11, 2013

@jdurand Are you sure you're running on the latest Spree? Can you show me your Gemfile.lock entry for Spree please?

@jdurand
Copy link
Contributor Author

jdurand commented Oct 11, 2013

I'm running Spree 2.0.5 from my own fork (for some reason I can't remember) and I keep it in sync with the 2-0-stable branch.
But I didn't get an error gracefully caught like you, I got the ugly uncaught error rails crash page thingy.

Here's my Gemfile.lock :

GIT
  remote: git://github.com/jdurand/spree.git
  revision: e871ad5ccbc44e2975a236c4213ed6957f263625

@jdurand
Copy link
Contributor Author

jdurand commented Oct 11, 2013

So after checking I need to run from my own fork because I had to play with jquery-rails and aws-sdk gem versions to match my bundle... but that's it.

@radar
Copy link
Contributor

radar commented Oct 11, 2013

Ok, everything's checking out here... I can't find any good reason for this patch not to work on your machine.

Can you stick a binding.pry within this method and then find out the value of what exception is please?

@jdurand
Copy link
Contributor Author

jdurand commented Oct 11, 2013

That's the thing, rescue_from_spree_gateway_error is never called. It's seems to me like rescue_from Spree::Core::GatewayError, :with => :rescue_from_spree_gateway_error is ignored somehow.

@jdurand
Copy link
Contributor Author

jdurand commented Oct 11, 2013

Got it, something in BrowserCMS is catching the exception before Spree and blindly shows an error page... That's my problem now.
Thanks for your help and sorry for the trouble.

@radar
Copy link
Contributor

radar commented Oct 11, 2013

No problem. Glad you were able to track that down :)

On Fri, Oct 11, 2013 at 4:09 PM, Jim notifications@github.com wrote:

Got it, something in BrowserCMS is catching the exception before Spree and blindly shows an error page... That's my problem now.

Thanks for your help and sorry for the trouble.

Reply to this email directly or view it on GitHub:
#3851 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants