Skip to content

Commit

Permalink
Handle shipping errors raises by calculator gracefully during admin o…
Browse files Browse the repository at this point in the history
…rders
  • Loading branch information
BDQ committed Sep 28, 2010
1 parent 0512997 commit 3a1edc2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions active_shipping_extension.rb
Expand Up @@ -51,6 +51,18 @@ def activate
Calculator::Usps::PriorityMailLargeFlatRateBox
].each(&:register)

# handle shipping errors gracefully on admin ui
Admin::ShipmentsController.class_eval do
rescue_from Spree::ShippingError, :with => :handle_shipping_error

private
def handle_shipping_error(e)
load_object
flash.now[:error] = e.message
render :action => "edit"
end
end

#Only required until following active_shipping commit is merged (add negotiated rates).
#http://github.com/BDQ/active_shipping/commit/2f2560d53aa7264383e5a35deb7264db60eb405a
ActiveMerchant::Shipping::UPS.send(:include, Spree::ActiveShipping::UpsOverride)
Expand Down

0 comments on commit 3a1edc2

Please sign in to comment.