From 755d5b7c77c3ae58774f1e749573e02320020746 Mon Sep 17 00:00:00 2001 From: Mederic Bazart Date: Tue, 16 Jan 2024 18:36:12 +0100 Subject: [PATCH] fix(http): invalid return on IsOtpError Fix https://github.com/Scalingo/cli/issues/1029 --- CHANGELOG.md | 2 ++ http/errors.go | 5 +++++ 2 files changed, 7 insertions(+) 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