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
ShippingError rescue is holding back other results #90
Comments
@rterbush I think that would make sense but only if we handle the exception of really no methods available through any provider in else we would return either an array with nil values or an empty array by the does this make sense? |
Agreed. We have recently encountered this in 2.0 and are dealing with it at the moment with the following: https://gist.github.com/rterbush/5853985 Still waiting on the seniors to weigh in on the general issue. |
@mrpollo I think that checking for available methods in the #rate_hash method of the Order model makes a lot of sense. @rterbush I'm not super familiar with this extension these days but I think I understand the issue at hand and believe you are both on the right track. Let me know if you need anymore assistance. |
@rterbush I'm submitting fixes for Spree 1-3, do you have it fixed on Spree 2 as well? maybe we can both send the PR's |
moved Error logic to the Order model on rate_hash
I will follow up with PRs on 2-0-stable and master. |
Feedback wanted, need to raise an error inside |
never-mind on the feedback |
removed raise ShippingError from compute, fix #90
remove raise ShippingError from compute, fix #90
remove raise ShippingError from comput, fix #90
oh wow nice, thanks! |
Lets say you are shipping to Russia (from US) here is an address:
Snezhinsk, 456770, Russian Federation
My defined shipping providers are: USPS and FedEx ( all services from both )
When I call
@order.rate_hash
it raises the following ShippingErrorthe error comes from:
raise rates_result if rates_result.kind_of?(Spree::ShippingError)
models/spree/calculator/shipping/active_shipping/base.rb#L58
The problem is that FedEx does not ship to that location in Russia (confirmed with FedEx over the phone), USPS does, but
@order.rate_hash
never gets a chance to get the rates from USPS because raise error halts the operation sending the error back to you.What is the best recommended way to deal with this situation?
The text was updated successfully, but these errors were encountered: