X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/6d1d9d9a7cf90b25a2e10af1c5bc56faee7e494c..a3b9849a54a6cd8a4cc5b1ae03a39aab31322f7b:/chatgpt.go diff --git a/chatgpt.go b/chatgpt.go index 302e143..7a5afc2 100644 --- a/chatgpt.go +++ b/chatgpt.go @@ -145,7 +145,7 @@ func (a *ChatGPTAuth) Login(ctx context.Context, out io.Writer) error { _, err = fmt.Fprintf(out, "Open %s/codex/device on any device and enter this code:\n\n %s\n\nWaiting for the approval...\n", a.issuer, userCode) if err != nil { - return err + return fmt.Errorf("write device code: %w", err) } grant, err := a.poll(ctx, code.DeviceAuthID, userCode, chatgptPollInterval(code.Interval)) @@ -164,8 +164,11 @@ func (a *ChatGPTAuth) Login(ctx context.Context, out io.Writer) error { } _, err = fmt.Fprintln(out, "Logged in.") + if err != nil { + return fmt.Errorf("write login result: %w", err) + } - return err + return nil } // read reads the token file.