Skip to content

Commit 6c1ffe9

Browse files
author
Iurii Krasnoshchok
committed
errors: add new function Temporary(error) bool
1 parent 3eab754 commit 6c1ffe9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/errors/errors.go

+8
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,11 @@ type errorString struct {
6767
func (e *errorString) Error() string {
6868
return e.s
6969
}
70+
71+
// Temporary returns true if it makes sense to retry the call that returned the error.
72+
func Temporary(err error) bool {
73+
if err, ok := err.(interface{ Temporary() bool }); ok {
74+
return err.Temporary()
75+
}
76+
return false
77+
}

0 commit comments

Comments
 (0)