fix error type comparison
This commit is contained in:
parent
00975237b1
commit
7c404d8b5e
@ -2,6 +2,7 @@ package retry
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
@ -11,8 +12,8 @@ var log = logging.Logger("retry")
|
|||||||
|
|
||||||
func errorIsIn(err error, errorTypes []error) bool {
|
func errorIsIn(err error, errorTypes []error) bool {
|
||||||
for _, etype := range errorTypes {
|
for _, etype := range errorTypes {
|
||||||
tmp := etype
|
tmp := reflect.New(reflect.PointerTo(reflect.ValueOf(etype).Elem().Type())).Interface()
|
||||||
if errors.As(err, &tmp) {
|
if errors.As(err, tmp) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user