Problem
Multiple files use bare except: clauses that catch all exceptions including system-level ones.
Locations:
backend/app/api/engine.py:358-361, 577-586, 652-675
backend/app/services/kb/builder.py:27-28, 61-62
Example:
try:
return json.loads(p)
except: # Catches KeyboardInterrupt, SystemExit!
return {}
Impact
- Hides real errors
- Difficult debugging
- May suppress critical errors
- Unprofessional code quality
Fix
Replace with specific exception types:
try:
return json.loads(p)
except (ValueError, json.JSONDecodeError) as e:
logger.warning(f"Failed to parse JSON: {e}", exc_info=True)
return {}
Action Plan
- Find all bare except:
grep -rn "except:" backend/app/
- Replace each with specific exception
- Add logging for caught exceptions
- Test error scenarios
Estimated Time
2-3 hours
References
- COMPREHENSIVE_TODO.md: CODE-001
Problem
Multiple files use bare
except:clauses that catch all exceptions including system-level ones.Locations:
backend/app/api/engine.py:358-361, 577-586, 652-675backend/app/services/kb/builder.py:27-28, 61-62Example:
Impact
Fix
Replace with specific exception types:
Action Plan
grep -rn "except:" backend/app/Estimated Time
2-3 hours
References