diff --git a/CHANGELOG.md b/CHANGELOG.md index 39a62f5b..cd4ceb7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## To Be Released +fix(errors): `IsOTPRequired` detects 'OTP Required' API errors + ## 6.7.5 fix(events): `link_scm` data types diff --git a/http/errors.go b/http/errors.go index c52e281a..946ca5cd 100644 --- a/http/errors.go +++ b/http/errors.go @@ -9,6 +9,7 @@ import ( "gopkg.in/errgo.v1" "github.com/Scalingo/go-scalingo/v6/debug" + scErrors "github.com/Scalingo/go-utils/errors/v2" ) type ( @@ -58,6 +59,10 @@ var ErrOTPRequired = errors.New("OTP Required") // IsOTPRequired tests if the authentication backend return an OTP Required error func IsOTPRequired(err error) bool { + if scErrors.Is(err, ErrOTPRequired) { + return true + } + rerr, ok := err.(*RequestFailedError) if !ok { return false