Skip to content

Handle remote HTTP errors - #61

Open
samuel-williams-shopify wants to merge 1 commit into
mainfrom
handle-remote-error
Open

Handle remote HTTP errors#61
samuel-williams-shopify wants to merge 1 commit into
mainfrom
handle-remote-error

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown

Summary

  • translate Protocol::HTTP::RemoteError to Faraday::ConnectionFailed
  • update the async-http dependency for RemoteError support
  • document and test retrying an idempotent request with faraday-retry

This demonstrates how the body error normalized by socketry/async-http#236 can participate in Faraday retry policy without adding hidden retries to the adapter. The original exception remains available through the Ruby exception cause chain.

Testing

  • full suite: 28 tests, 139 assertions
  • RuboCop: 21 files, no offenses

require "faraday/retry"

connection = Faraday.new(...) do |builder|
builder.request :retry, exceptions: [Faraday::ConnectionFailed]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this somewhat redundant with async-http's internal retries of socket failures? might this cause issues for PUT body streams that may have been drained? i have no qualms with the documentation, just trying to learn 🙂

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.

2 participants