Using Excpetional with RobustThread

Adam's Avatar

Adam

09 Sep, 2010 04:28 PM

Hey guys,

I'd like to use exceptional with an collection of daemons I'm thinking about building with RobustThread.

The problem I have is dealing with RT's own excpetion handling.

The RT documentation gives this as an example:

require 'rubygems'
require 'robustthread'
RobustThread.logger = Logger.new('mydaemon.log')
RobustThread.exception_handler do |exception|
  email_me_the_exception(exception)
end
pid = fork do
  RobustThread.loop(:seconds => 30, :label => "Do something awesome!") do
    do_something_awesome
  end
  sleep
end
Process.detach pid`

While I could wrap do_something_awesome in a Exceptional.rescue block, it seems that it should go into RobustThread's exception_handler for neatness sake if nothing else.

Is such a thing possible or do I take the obvious route?

  1. 1 Posted by Ciaran Lee on 09 Sep, 2010 04:33 PM

    Ciaran Lee's Avatar

    Hi Adam,

    I don't know anything about Robust Thread, but if it has it's own exception_handler then you could patch that to include:
    Exceptional.handle(e, 'optional error message')

    Hopefully this will work for you!

    Regards,
    Ciaran

  2. Ciaran Lee closed this discussion on 09 Sep, 2010 04:33 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac