Browse files

Merge pull request #45 from hooktstudios/rescue-orders-patch

Rescue from shipping error in orders controllers.
  • Loading branch information...
2 parents e797dc2 + 0a032f5 commit 7c44b7e5cc3df421df4815c703632e759fd5e031 @jumph4x jumph4x committed Oct 4, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 app/controllers/spree/orders_controller_decorator.rb
View
11 app/controllers/spree/orders_controller_decorator.rb
@@ -0,0 +1,11 @@
+# handle shipping errors gracefully during order update
+Spree::OrdersController.class_eval do
+
+ rescue_from Spree::ShippingError, :with => :handle_shipping_error
+
+ private
+ def handle_shipping_error(e)
+ flash[:error] = e.message
+ redirect_back_or_default(root_path)
+ end
+end

0 comments on commit 7c44b7e

Please sign in to comment.