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
Improve exception handling and add class-level handler for GenerationJob (#320)
Addresses issues raised in PRs #309 and #310 with proper test coverage.
## Changes
### Fix raw_response pollution (Issue #305)
- with_exception_handling now explicitly returns nil after handling an exception
- Prevents handler return values from becoming raw_response and causing
secondary NoMethodError when calling methods like `usage` on it
### Add class-level handle_exception for GenerationJob (Issue #306)
- Add handle_exception class method to ActiveAgent::Rescue concern
- Called by GenerationJob#handle_exception_with_agent_class as fallback
- Uses configurable logger (rescue_logger) instead of hardcoded Rails.logger
- Re-raises exception after logging to preserve job failure semantics
- Logger fallback chain: class logger → ActiveAgent::Base.logger → Rails.logger → $stderr
### Test Coverage
- Update exception_handler_test.rb to expect nil return after handling
- Add tests for class-level handle_exception method
- Add test for GenerationJob integration
- Add test verifying raw_response pollution fix
Fixes#305, #306
Supersedes #309, #310
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: TheRealNeil <3514122+TheRealNeil@users.noreply.github.com>
0 commit comments