diff --git a/client_options.go b/client_options.go index d2434b5b1..4774ed32d 100644 --- a/client_options.go +++ b/client_options.go @@ -94,6 +94,14 @@ func WithCustomRetryWaitMinMax(waitMin, waitMax time.Duration) ClientOptionFunc } } +// WithErrorHandler can be used to configure a custom error handler. +func WithErrorHandler(handler retryablehttp.ErrorHandler) ClientOptionFunc { + return func(c *Client) error { + c.client.ErrorHandler = handler + return nil + } +} + // WithHTTPClient can be used to configure a custom HTTP client. func WithHTTPClient(httpClient *http.Client) ClientOptionFunc { return func(c *Client) error {