diff options
| author | 2025-05-26 16:13:55 +0200 | |
|---|---|---|
| committer | 2025-05-26 16:13:55 +0200 | |
| commit | 143febb318ee16ca68ea312249ab5dadeab608bb (patch) | |
| tree | 594820ce5f746c7c9d0e28cc8820da563b0c4bdd /vendor/github.com/cenkalti/backoff/v5/error.go | |
| parent | [chore] migration to update `statuses.thread_id` to be notnull (#4160) (diff) | |
| download | gotosocial-143febb318ee16ca68ea312249ab5dadeab608bb.tar.xz | |
[chore] update dependencies (#4196)
- go.opentelemetry.io/contrib/exporters/autoexport v0.60.0 -> v0.61.0
- go.opentelemetry.io/contrib/instrumentation/runtime v0.60.0 -> v0.61.0
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4196
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/cenkalti/backoff/v5/error.go')
| -rw-r--r-- | vendor/github.com/cenkalti/backoff/v5/error.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/github.com/cenkalti/backoff/v5/error.go b/vendor/github.com/cenkalti/backoff/v5/error.go new file mode 100644 index 000000000..beb2b38a2 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/error.go @@ -0,0 +1,46 @@ +package backoff + +import ( + "fmt" + "time" +) + +// PermanentError signals that the operation should not be retried. +type PermanentError struct { + Err error +} + +// Permanent wraps the given err in a *PermanentError. +func Permanent(err error) error { + if err == nil { + return nil + } + return &PermanentError{ + Err: err, + } +} + +// Error returns a string representation of the Permanent error. +func (e *PermanentError) Error() string { + return e.Err.Error() +} + +// Unwrap returns the wrapped error. +func (e *PermanentError) Unwrap() error { + return e.Err +} + +// RetryAfterError signals that the operation should be retried after the given duration. +type RetryAfterError struct { + Duration time.Duration +} + +// RetryAfter returns a RetryAfter error that specifies how long to wait before retrying. +func RetryAfter(seconds int) error { + return &RetryAfterError{Duration: time.Duration(seconds) * time.Second} +} + +// Error returns a string representation of the RetryAfter error. +func (e *RetryAfterError) Error() string { + return fmt.Sprintf("retry after %s", e.Duration) +} |
