README.md in faraday-retry-2.2.0 vs README.md in faraday-retry-2.2.1
- old
+ new
@@ -73,19 +73,27 @@
```
#### Specify which exceptions should trigger a retry
You can provide an `exceptions` option with a list of exceptions that will replace
-the default list of network-related exceptions: `Errno::ETIMEDOUT`, `Timeout::Error`, `Faraday::TimeoutError`.
+the default exceptions: `Errno::ETIMEDOUT`, `Timeout::Error`, `Faraday::TimeoutError`, `Faraday::Error::RetriableResponse`.
This can be particularly useful when combined with the [RaiseError][raise_error] middleware.
```ruby
retry_options = {
exceptions: [Faraday::ResourceNotFound, Faraday::UnauthorizedError]
}
```
+If you want to inherit default exceptions, do it this way.
+
+```ruby
+retry_options = {
+ exceptions: Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Faraday::ResourceNotFound, Faraday::UnauthorizedError]
+}
+```
+
#### Specify on which response statuses to retry
By default the `Retry` middleware will only retry the request if one of the expected exceptions arise.
However, you can specify a list of HTTP statuses you'd like to be retried. When you do so, the middleware will
check the response `status` code and will retry the request if included in the list.
@@ -142,14 +150,12 @@
### Call a block on every retry
You can specify a proc object through the `retry_block` option that will be called before every
retry, before There are many different applications for this feature, spacing from instrumentation to monitoring.
-
The block is passed keyword arguments with contextual information: Request environment, middleware options, current number of retries, exception, and amount of time we will wait before retrying. (retry_block is called before the wait time happens)
-
For example, you might want to keep track of the response statuses:
```ruby
response_statuses = []
retry_options = {
@@ -175,6 +181,6 @@
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
-[raise_error]: https://lostisland.github.io/faraday/middleware/raise-error
+[raise_error]: https://lostisland.github.io/faraday/#/middleware/included/raising-errors