mirror of
https://github.com/docker/cli.git
synced 2026-11-06 13:10:41 -04:00
internal/oauth: remove debug logs, and move them to the caller
Wrap errors in the OAuth manager instead of logging them, preserving the underlying cause while allowing callers to detect startup failures. Log failures at the fallback handler and scope the device-code login result to its branch. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -18,8 +18,6 @@ import (
|
||||
"github.com/docker/cli/internal/registry"
|
||||
"github.com/docker/cli/internal/tui"
|
||||
"github.com/morikuni/aec"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/pkg/browser"
|
||||
)
|
||||
|
||||
@@ -89,13 +87,11 @@ func (m *OAuthManager) LoginDevice(ctx context.Context, w io.Writer) (*types.Aut
|
||||
|
||||
state, err := m.api.GetDeviceCode(ctx, m.audience)
|
||||
if err != nil {
|
||||
logrus.Debugf("failed to start device code login: %v", err)
|
||||
return nil, ErrDeviceLoginStartFail
|
||||
return nil, fmt.Errorf("%w: %w", ErrDeviceLoginStartFail, err)
|
||||
}
|
||||
|
||||
if state.UserCode == "" {
|
||||
logrus.Debugf("failed to start device code login: missing user code")
|
||||
return nil, ErrDeviceLoginStartFail
|
||||
return nil, fmt.Errorf("%w: missing user code", ErrDeviceLoginStartFail)
|
||||
}
|
||||
|
||||
var out tui.Output
|
||||
|
||||
Reference in New Issue
Block a user