fserrors: Look deeper into errors for Fatal/Retry/NoRetry errors.

Before this change fatal errors which were wrapped in a system error (eg a
URLError) were not recognised as fatal errors.
This commit is contained in:
Nick Craig-Wood 2018-05-03 14:46:20 +01:00
parent be79b47a7a
commit f95835d613

View file

@ -69,7 +69,7 @@ func IsRetryError(err error) bool {
if err == nil { if err == nil {
return false return false
} }
err = errors.Cause(err) _, err = Cause(err)
if r, ok := err.(Retrier); ok { if r, ok := err.(Retrier); ok {
return r.Retry() return r.Retry()
} }
@ -114,7 +114,7 @@ func IsFatalError(err error) bool {
if err == nil { if err == nil {
return false return false
} }
err = errors.Cause(err) _, err = Cause(err)
if r, ok := err.(Fataler); ok { if r, ok := err.(Fataler); ok {
return r.Fatal() return r.Fatal()
} }
@ -159,7 +159,7 @@ func IsNoRetryError(err error) bool {
if err == nil { if err == nil {
return false return false
} }
err = errors.Cause(err) _, err = Cause(err)
if r, ok := err.(NoRetrier); ok { if r, ok := err.(NoRetrier); ok {
return r.NoRetry() return r.NoRetry()
} }