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::ShippingError not being rescued in Checkout Controller decorator #15

Closed
ecnal opened this issue Jan 9, 2012 · 4 comments
Closed

Comments

@ecnal
Copy link

ecnal commented Jan 9, 2012

Shipping Error: The postal code 77401 is invalid for MD United States.

~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree    _active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:87:in `rescue in retrieve_rates'
~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree_active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:67:in `retrieve_rates'
~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree_active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:33:in `block in compute'
activesupport (3.1.3) lib/active_support/cache.rb:297:in `block in fetch'
activesupport (3.1.3) lib/active_support/cache.rb:520:in `instrument'
activesupport (3.1.3) lib/active_support/cache.rb:296:in `fetch'
~/.rvm/gems/ruby-1.9.2-p290@deepchange/bundler/gems/spree_active_shipping-a85128c2ddd9/app/models/calculator/active_shipping/base.rb:32:in `compute'
spree_core (0.70.3) app/models/order.rb:342:in `block in rate_hash'
spree_core (0.70.3) app/models/order.rb:341:in `collect'
spree_core (0.70.3) app/models/order.rb:341:in `rate_hash'
spree_core (0.70.3) app/controllers/checkout_controller.rb:87:in `before_delivery'
spree_core (0.70.3) app/controllers/checkout_controller.rb:77:in `state_callback'
spree_core (0.70.3) app/controllers/checkout_controller.rb:67:in `load_order'
activesupport (3.1.3) lib/active_support/callbacks.rb:448:in `_run__64289423__process_action__626393581__callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'
activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.1.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.3) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal.rb:236:in `block in action'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `call'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:29:in `call'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `block in call'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `block in recognize'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:532:in `call'
spree_core (0.70.3) lib/redirect_legacy_product_url.rb:10:in `call'
spree_core (0.70.3) lib/middleware/seo_assist.rb:23:in `call'
warden (1.0.6) lib/warden/manager.rb:35:in `block in call'
warden (1.0.6) lib/warden/manager.rb:34:in `catch'
warden (1.0.6) lib/warden/manager.rb:34:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.5) lib/rack/etag.rb:23:in `call'
rack (1.3.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/flash.rb:247:in `call'
rack (1.3.5) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.5) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/cookies.rb:331:in `call'
activerecord (3.1.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.3) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
rails-dev-tweaks (0.5.2) lib/rails_dev_tweaks/granular_autoload/middleware.rb:34:in `call'
rack (1.3.5) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.5) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.5) lib/rack/lock.rb:15:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.3) lib/rails/engine.rb:456:in `call'
rack (1.3.5) lib/rack/content_length.rb:14:in `call'
railties (3.1.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.5) lib/rack/handler/webrick.rb:59:in `service'
~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
@ecnal
Copy link
Author

ecnal commented Jan 10, 2012

I tried rescuing from the application controller but that didn't work. What did work was to put the rescue in the SpreeBase Module.

@radar
Copy link
Contributor

radar commented Mar 13, 2012

Could you please provide some steps to reproduce this issue? Thanks.

@jsqu99
Copy link
Contributor

jsqu99 commented Apr 25, 2012

Steps to reproduce:

Having UPS/FedEx as available shipping methods, try to place an order using a mismatched State/Zip. (e.g. Alaska / 20735).

The error should show a flash and allow the user to re-enter the address info, but instead causes a 500 error, as the controller decorators are never being loaded.

I added:

  Dir.glob(File.join(File.dirname(__FILE__), "../../../app/**/*_decorator*.rb")) do |c|
    Rails.configuration.cache_classes ? require(c) : load(c)
  end

to the activate method and this fixed the problem locally.

I will try to submit a pull request / run tests ASAP (flying back home tomorrow from Railsconf)

@jsqu99
Copy link
Contributor

jsqu99 commented Apr 26, 2012

#28

@jsqu99 jsqu99 closed this as completed in e3c45b7 Apr 26, 2012
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

3 participants