README.md in ezclient-1.6.0 vs README.md in ezclient-1.7.0
- old
+ new
@@ -44,10 +44,11 @@
- `on_retry` – callback called on request retry
- `retry_exceptions` – an array of exception classes to retry
- `ssl_context` – ssl context for requests (an `OpenSSL::SSL::SSLContext` instance)
- `timeout` – timeout for requests in seconds or hash like `{ read: 5, write: 5, connect: 1 }`
- `follow` – enable following redirects (`true` or hash with options – e.g. `{ max_hops: 1, strict: false}`)
+- `error_wrapper` – callback called on request exception, makes it possible to handle any error, default behavior: `raise error`
All these options are passed to each request made by this client but can be overriden on per-request basis.
Extra per-request only options are:
@@ -89,16 +90,18 @@
```ruby
on_complete = -> (request, response, metadata) { ... }
on_error = -> (request, error, metadata) { ... }
on_retry = -> (request, error, metadata) { ... }
+error_wrapper = -> (request, error, metadata) { raise error }
client = EzClient.new(
on_complete: on_complete,
on_error: on_error,
on_retry: on_retry,
retry_exceptions: [StandardError],
max_retries: 2,
+ error_wrapper: error_wrapper
)
response = client.perform!(:get, url, metadata: :hello)
```