-
Notifications
You must be signed in to change notification settings - Fork 44
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
Fix error propagating logic #515
Fix error propagating logic #515
Conversation
Meilisearch::ApiError parses a server's JSON response into its `@http_body` instance variable which stores a hash. When `version_error_handler` propagates ApiError, it passes `@http_body` as the server http body which causes ApiError to attempt to parse it again as JSON, throwing a TypeError.
Allows easier propagation of ApiError.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #515 +/- ##
==========================================
+ Coverage 99.62% 99.81% +0.18%
==========================================
Files 9 9
Lines 540 542 +2
==========================================
+ Hits 538 541 +3
+ Misses 2 1 -1 ☔ View full report in Codecov by Sentry. |
@ellnix I put @brunoocasali as reviewer: he's the maintainer of this repo. I just try to help him sometimes when he has too much on his plate 😊 |
Oh okay then, I apologize for requesting a review. 👍 |
Don't worry, you are right, if you hesitate, you can also ping me 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
bors merge |
Pull Request
Related issue
Fixes #513
What does this PR do?
@http_body
instance variable which stores a hash.version_error_handler
propagatesApiError
, it passes the@http_body
hash as http body which causes
ApiError
to attempt to parse itagain as JSON, throwing a
TypeError
.http_body
parameter polymorphic, allowing either a hash or a JSON string to be passed.