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:
Sebastiaan van Stijn
2026-10-19 21:07:33 +02:00
parent fa65e9a3a0
commit df9a0f430f
2 changed files with 8 additions and 12 deletions
+2 -6
View File
@@ -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