Skip to content
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

JSON parseable error messages #1140

Merged
merged 2 commits into from
Apr 12, 2023
Merged

JSON parseable error messages #1140

merged 2 commits into from
Apr 12, 2023

Conversation

nelsonwittwer
Copy link
Contributor

@nelsonwittwer nelsonwittwer commented Apr 12, 2023

Description

Fixes #1033

Please, include a summary of what the PR is for:
As indicated in #1033, our error messages have not been structured in a JSON serializable manner making them very difficult to parse and pass off to the front end to handle.

How has this been tested?

  • Unit tests with the expected error data structure
  • Pointed at this local branch with a sample CLI created app and verified the errors were JSON parsable:
irb(main):007:0> JSON.parse  "{\"errors\":{\"line_items\":[\"must have at least one line item\"]},\"error_reference\":\"If you report this error, please include this id: 6aa2cdec-9c4f-4f09-8c6d-c059564eacce.\"}"
=> {"errors"=>{"line_items"=>["must have at least one line item"]}, "error_reference"=>"If you report this error, please include this id: 6aa2cdec-9c4f-4f09-8c6d-c059564eacce."}

Checklist:

  • My commit message follow the pattern described in here
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the project documentation.
  • I have added a changelog line.

@nelsonwittwer nelsonwittwer merged commit a05d67e into main Apr 12, 2023
@nelsonwittwer nelsonwittwer deleted the nelsonwittwer/json_errors branch April 12, 2023 19:17
nickmealey pushed a commit to heliumdevelopment/shopify-api-ruby that referenced this pull request Jun 6, 2023
* JSON parseable error messages

* changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors not JSON parsable
2 participants