Skip to content

Commit

Permalink
fix(http): invalid return on IsOtpError
Browse files Browse the repository at this point in the history
  • Loading branch information
ipfaze authored and curzolapierre committed Feb 12, 2024
1 parent 3a81bbe commit 755d5b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## To Be Released

fix(errors): `IsOTPRequired` detects 'OTP Required' API errors

## 6.7.5

fix(events): `link_scm` data types
Expand Down
5 changes: 5 additions & 0 deletions http/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 755d5b7

Please sign in to comment.