Shopify / Shopify/shopify-api-ruby
Bug in error handling in Shopify::Rest::Base#save
@mllemango is already working on this.
Since Sep 5, 2023.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 484
- PR merge metrics
- No merged PRs in 30d
Description
Issue summary
Since v13.0.0 ShopifyAPI::DiscountCode#errors signature has been changed to Hash, and #errors is initialized as Hashnil for DiscountCode resources.
This causes exception in error handling in ShopifyAPI::Rest::Base#save if ShopifyAPI::Errors::HttpResponseError is raised during save operation for DiscountCode resource. Exception is raised because Hashnil does not implement #errors
shopify_apiversion: 13.1.0- Ruby version: 2.7.7
Expected behavior
Rescuing from ShopifyAPI::Errors::HttpResponseError does not raise exception
Actual behavior
#<NoMethodError: undefined method `errors' for {}:Hash> is raised
#<NoMethodError: undefined method `errors' for nil:NilClass> is raised
Edit: corrected details
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.