Skip to content

Conversation

@xico42
Copy link
Contributor

@xico42 xico42 commented Jul 3, 2025

Motivation / Background

This PR addresses the issue #571. The idea here is to allow clients to specify exactly which errors are retryable or not.

Retryable errors are typically caused by transient failures such as timeouts or connection issues.

However, there may be cases where certain errors are known to be non-retryable, for example, malformed input messages.

This change adds a ShouldRetry parameter to the retry middleware configuration, allowing clients to explicitly define which errors should be retried and which should not.

Detail

At the company I work for, we use a custom error package that allows us to have a fine control of which errors are retryable or not.

So, it would be great if the Retry middleware could be customized to ignore those errors we already know
that are not retryable.

Alternative approaches considered (if applicable)

Not considered!

Checklist

  • I wrote tests for the changes.
  • All tests are passing.
  • Code has no breaking changes.
  • Documentation on watermill.io is updated.
    • I have updated only the godoc documentation
Retryable errors are typically caused by transient failures
such as timeouts or connection issues.

However, there may be cases where certain errors are known to
be non-retryable, for example, malformed input messages.

This change adds a ShouldRetry parameter to the retry middleware
configuration, allowing clients to explicitly define which
errors should be retried and which should not.
@xico42 xico42 force-pushed the should-retry-func branch from 1ce3afe to ace0ce9 Compare July 3, 2025 13:12
@m110 m110 merged commit 203cb9c into ThreeDotsLabs:master Jul 3, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants