mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
refactor: improve error handling code quality
Address code review feedback from Gemini Code Assist: 1. Reduce duplication in ClaudeProvider catch block - Consolidate error creation logic into single path - Use conditional message building instead of duplicate blocks - Improves maintainability and follows DRY principle 2. Better separation of concerns in error utilities - Move default retry-after (60s) logic from extractRetryAfter to classifyError - extractRetryAfter now only extracts explicit values - classifyError provides default using nullish coalescing (?? 60) - Clearer single responsibility for each function 3. Update test to match new behavior - extractRetryAfter now returns undefined for rate limits without explicit value - Default value is tested in classifyError tests instead All 162 tests still passing ✅ Builds successfully with no TypeScript errors ✅
This commit is contained in:
@@ -145,9 +145,9 @@ describe('error-handler.ts', () => {
|
||||
expect(extractRetryAfter(error)).toBe(30);
|
||||
});
|
||||
|
||||
it('should return default 60 for rate limit errors without explicit retry-after', () => {
|
||||
it('should return undefined for rate limit errors without explicit retry-after', () => {
|
||||
const error = new Error('429 rate_limit_error');
|
||||
expect(extractRetryAfter(error)).toBe(60);
|
||||
expect(extractRetryAfter(error)).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should return undefined for non-rate-limit errors', () => {
|
||||
|
||||
Reference in New Issue
Block a user