Skip to content

Add handle_exception method to log errors during GenerationJob execution#310

Open
TheRealNeil wants to merge 1 commit intoactiveagents:mainfrom
qlarity:fix-missing-class-method-handle_exception
Open

Add handle_exception method to log errors during GenerationJob execution#310
TheRealNeil wants to merge 1 commit intoactiveagents:mainfrom
qlarity:fix-missing-class-method-handle_exception

Conversation

@TheRealNeil
Copy link
Contributor

@TheRealNeil TheRealNeil commented Feb 8, 2026

Add missing handle_exception class method to Rescue concern

Fixes #306

Summary

  • Add handle_exception class method to ActiveAgent::Concerns::Rescue so that GenerationJob#handle_exception_with_agent_class has something to call

Root cause

GenerationJob#handle_exception_with_agent_class calls klass.handle_exception(exception) (a class method), but the Rescue concern only defines instance methods. This causes a NoMethodError when a job-level exception is raised during generate_later.

Fix

Add a handle_exception class method to the Rescue concern's class_methods block. It logs the exception class, message, and first 10 lines of the backtrace via Rails.logger.error.

Test plan

  • Trigger an unhandled exception during generate_later and confirm it is logged rather than raising NoMethodError
  • Confirm rescue_from instance-level handlers still work as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GenerationJob calls missing class method handle_exception

1 participant