mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
feat: improve rate limit error handling with user-friendly messages
- Add rate_limit error type to ErrorInfo classification - Implement isRateLimitError() and extractRetryAfter() utilities - Enhance ClaudeProvider error handling with actionable messages - Add comprehensive test coverage (8 new tests, 162 total passing) **Problem:** When hitting API rate limits, users saw cryptic 'exit code 1' errors with no explanation or guidance on how to resolve the issue. **Solution:** - Detect rate limit errors (429) and extract retry-after duration - Provide clear, user-friendly error messages with: * Explanation of what went wrong * How long to wait before retrying * Actionable tip to reduce concurrency in auto-mode - Preserve original error details for debugging **Changes:** - libs/types: Add 'rate_limit' type and retryAfter field to ErrorInfo - libs/utils: Add rate limit detection and extraction logic - apps/server: Enhance ClaudeProvider with better error messages - tests: Add 8 new test cases covering rate limit scenarios **Benefits:** ✅ Clear communication - users understand the problem ✅ Actionable guidance - users know how to fix it ✅ Better debugging - original errors preserved ✅ Type safety - proper TypeScript typing ✅ Comprehensive testing - all edge cases covered See CHANGELOG_RATE_LIMIT_HANDLING.md for detailed documentation.
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
/**
|
||||
* Error type classification
|
||||
*/
|
||||
export type ErrorType = 'authentication' | 'cancellation' | 'abort' | 'execution' | 'unknown';
|
||||
export type ErrorType =
|
||||
| 'authentication'
|
||||
| 'cancellation'
|
||||
| 'abort'
|
||||
| 'execution'
|
||||
| 'rate_limit'
|
||||
| 'unknown';
|
||||
|
||||
/**
|
||||
* Classified error information
|
||||
@@ -12,5 +18,7 @@ export interface ErrorInfo {
|
||||
isAbort: boolean;
|
||||
isAuth: boolean;
|
||||
isCancellation: boolean;
|
||||
isRateLimit: boolean;
|
||||
retryAfter?: number; // Seconds to wait before retrying (for rate limit errors)
|
||||
originalError: unknown;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user