Skip to content

Commit

Permalink
Merge pull request #34 from shogo82148/fix-upgrade-guide
Browse files Browse the repository at this point in the history
fix upgrading guide
  • Loading branch information
shogo82148 authored Jun 25, 2024
2 parents dd7b133 + f91b7b0 commit 5623824
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ the retry mechanism was modified to respect the result of the method.
In v2, the package doesn't check the Temporary() method.
The retry mechanism will proceed unless the error is marked as non-retryable by MarkPermanent.

If you want the same behavior as v1, you need to rewrite it as follows:

```go
// v1 code
policy.Do(func() error {
Expand All @@ -148,7 +150,7 @@ policy.Do(func() error {
}
var tmp temporary
if errors.As(err, &tmp) && !tmp.Temporary() {
return retry.MarkTemporary(err)
return retry.MarkPermanent(err)
}
return err
})
Expand Down

0 comments on commit 5623824

Please sign in to comment.