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

Add DEFAULT_EXCEPTIONS constant to Request::Retry #814

Merged
merged 2 commits into from
Aug 23, 2018

Conversation

krmannix
Copy link
Contributor

Description

Adds a DEFAULT_EXCEPTIONS constant to Request::Retry, which allows easy access much like the IDEMPOTENT_METHODS constant

Todos

None

Additional Notes

Initial request in Issue 813

@@ -20,6 +20,7 @@ module Faraday
#
class Request::Retry < Faraday::Middleware

DEFAULT_EXCEPTIONS = [Errno::ETIMEDOUT, 'Timeout::Error', Error::TimeoutError, Faraday::Error::RetriableResponse]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One potential addition is calling .freeze on this array, as exposing this list rather than constructing it on each call to exceptions means it's now modifiable by users. That may be okay though.

Copy link
Member

@iMacTia iMacTia Aug 23, 2018

Choose a reason for hiding this comment

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

Good point @krmannix.
However being this a constant, I would rather .freeze it and make it immutable as you suggested.
If we want to improve the way you simply add new exceptions to the list, we should probably revisit the API and provide a better way to do it.
No need to think about it now though, let's improve one bit at a time 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great! I'll update. Thanks for the quick response!

@iMacTia iMacTia merged commit f26a8d6 into lostisland:master Aug 23, 2018
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