Permalink
Browse files

Add specific error handling for Canada Post

  • Loading branch information...
1 parent 6e85e03 commit 36f129836e4c53175bd04e3ebcc73e49af755be0 @jbourassa jbourassa committed with j15e Jun 22, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 app/models/spree/calculator/active_shipping/base.rb
@@ -87,6 +87,9 @@ def retrieve_rates(origin, destination, packages)
params = e.response.params
if params.has_key?("Response") && params["Response"].has_key?("Error") && params["Response"]["Error"].has_key?("ErrorDescription")
message = params["Response"]["Error"]["ErrorDescription"]
+ # Canada Post specific error message
+ elsif params.has_key?("eparcel") && params["eparcel"].has_key?("error") && params["eparcel"]["error"].has_key?("statusMessage")
+ message = e.response.params["eparcel"]["error"]["statusMessage"]
else
message = e.message
end

0 comments on commit 36f1298

Please sign in to comment.