You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe it would be worthwhile creating Shopify.Error to "standardize" the error format.
Please let me know what you think? If I at least start on adding a clause for handle_response figuring out the details of implementation as I go, would you accept such PR?
Currently I use this workaround:
trydoresult=Product.create(session,payload)rescue# Catch unhandled timeout error in Shopify libeinFunctionClauseError->{:error,record,e}end
The text was updated successfully, but these errors were encountered:
First of all, thanks for the work you already put into thinking about this issue, really appreciated!
You are absolutely right, there are unhandled errors that will sometimes break an app with a pretty unclear error message... I would love to put some work into that and handle known errors more gracefully.
Right now, according to the documentation, the resource methods are supposed to return {:ok, %Shopify.Response{}} or {:error, %Shopify.Response{}}, I would like to stick to this format of a 2 element tuple and either :ok or :error, but we can introduce a %Shopify.Error{} struct.
Regarding the implementation:
I think returning {:error, %Shopify.Error{}} would bubble up, so guess your approach would work 👍
We would have to put some thought into the error fields, since we might want to use it for the errors returned by the shopify api as well, for that we would need a data and a code field to make it backwards compatible.
If you want to take a shot at it, I will be more than happy to review and merge 🔥
EDIT: @vladimir-e just to make sure you get notified
Hello. First of all thanks a lot for making this lib!
I faced a problem while using the lib and would like to discuss a solution, so I can submit a PR fixing it.
During long-running process of importing products via Shopify API, we occasionally get the following error:
It happens here:
https://github.com/nsweeting/shopify/blob/master/lib/shopify/adapters/http.ex
I believe we could add another clause for
handle_response
catching everything else and return something like:Maybe it would be worthwhile creating
Shopify.Error
to "standardize" the error format.Please let me know what you think? If I at least start on adding a clause for
handle_response
figuring out the details of implementation as I go, would you accept such PR?Currently I use this workaround:
The text was updated successfully, but these errors were encountered: