-
Notifications
You must be signed in to change notification settings - Fork 474
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
Errors not JSON parsable #1033
Comments
Would love to see some more attention paid to how developers are supposed to handle errors. Has anyone at Shopify actually tried building an app with this version of the gem? It's really painful. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Not stale. This bot that marks things as closed even though they haven't been addressed in literally any way seem fairly unfriendly to app developers. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Not stale. This bot sucks. |
Not stale. These HTTP errors need to be better explained. |
Finally getting to this 😬 😅 Let me know what ya'll think of this proposed fix: #1140 |
Issue summary
Write a short description of the issue here ↓
returns
I just need something like {line_items: 'must have at least one line item'} to return to the frontend, for example
This is a VERY hacky way I made it work
But it's definitely ugly and not performant
The cause of the issue is this line https://github.com/Shopify/shopify-api-ruby/blob/main/lib/shopify_api/clients/http_client.rb#L66
You are basically adding a simple string to a JSON-array.
It would be easily fixed by
error_messages << { error_id: "If you report this error, please include this id: #{id}."}
Expected behavior
What do you think should happen?
shopify_order.errors.errors.first
should return something JSON-parsable, a hash or something similarActual behavior
What actually happens?
shopify_order.errors.errors.first returns
#<ShopifyAPI::Errors::HttpResponseError: {"order"=>"Required parameter missing or invalid"}
If you report this error, please include this id: .>
To parse that, you need a tricky ugly code.
Steps to reproduce the problem
Logs
If applicable, enable the logs as described in the README, and paste the relevant portion here.
Specifications
shopify_api
version: 122020-07
): 2022-07The text was updated successfully, but these errors were encountered: