You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: replace log.Fatal with proper error returns in client constructors (#327)
* fix: replace log.Fatal with proper error returns in client constructors
Replace all log.Fatal calls in client constructor functions with proper
error returns to allow library users to handle errors gracefully instead
of crashing the entire application.
Changes:
- Updated NewOAuthClientCredentials to return (*Client, error)
- Updated NewOAuth to return (*Client, error)
- Updated NewOAuthWithCode to return (*Client, string, error)
- Updated NewOAuthWithRefreshToken to return (*Client, string, error)
- Updated NewOAuthbearerToken to return (*Client, error)
- Updated NewBasicAuth to return (*Client, error)
- Updated injectClient to return (*Client, error)
- Removed unused log import
- Updated all test files to handle the new error returns
This ensures the library behaves as a proper library and doesn't force
the calling application to exit on authentication errors.
Fixes#326
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: add error context wrapping in OAuth client constructors
Improve error diagnostics by wrapping errors returned from injectClient
with additional context in NewOAuthWithCode and NewOAuthWithRefreshToken.
This creates a clearer error chain for callers to inspect and debug.
Changes:
- Wrap injectClient error in NewOAuthWithCode with "failed to create client"
- Wrap injectClient error in NewOAuthWithRefreshToken with "failed to create client"
This addresses review feedback from @gemini-code-assist.
* deprecate: mark NewOAuth as deprecated due to stdin/stdout usage
The NewOAuth function uses stdin/stdout directly, making it unsuitable
for non-interactive environments such as web servers and background jobs.
This marks the function as deprecated and recommends using NewOAuthWithCode
instead, where users can obtain the authorization code through their own
UI/CLI implementation.
This addresses the design concern raised in review feedback from
@gemini-code-assist.
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments