changelog: Improvements, In-Person Proofing, uses correct error handling#7192
Merged
allthesignals merged 1 commit intomainfrom Oct 24, 2022
Merged
Conversation
aduth
approved these changes
Oct 24, 2022
app/services/arcgis_api/geocoder.rb
Outdated
Comment on lines
+52
to
+54
| error_code = response_body.dig('error', 'code') | ||
|
|
||
| raise Faraday::ClientError.new(RuntimeError.new("received error code #{error_code}"), response_body) |
Contributor
There was a problem hiding this comment.
Could we add / update specs to clarify what we're expecting with these changes? It'd also help from a review perspective to understand the intended effect.
Something like this?
it 'returns an error response body but with Status coded as 200' do
stub_request_suggestions_error
expect { subject.suggest('100 Main') }.to raise_error do |error|
expect(error).to be_instance_of(Faraday::ClientError)
expect(error.message).to eq('received error code 400')
expect(error.response).to be_kind_of(Hash)
end
end
Contributor
Author
There was a problem hiding this comment.
Sure, @zachmargolis pointed out in a previous PR that I was using ClientError.new incorrectly. This change adds a more helpful message.
I'll add more assertions.
Thanks!
zachmargolis
approved these changes
Oct 24, 2022
app/services/arcgis_api/geocoder.rb
Outdated
Comment on lines
+52
to
+54
| error_code = response_body.dig('error', 'code') | ||
|
|
||
| raise Faraday::ClientError.new(RuntimeError.new("received error code #{error_code}"), response_body) |
ddd4275 to
0170282
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎫 Ticket
Link to the relevant ticket.
🛠 Summary of changes
Implements better error handling by passing the correct args (context).
📜 Testing Plan
Instead of "Faraday::ClientError: the server responded with status" we get a more help message: