fmmfonseca/work_queue

stacktrace from within thread

breunigs opened this issue · 1 comments

I’m not sure if I’m just not seeing it, but is there a nice way to get the stacktrace/error from an enqueued thread? I know failed Threads return nil, but I have yet to find a way to access the exception without including or monkey patching a rescue block that prints the stackttrace. Any hints would greatly appreciated.

1.9.3p194 :004 > wq.enqueue_b { put "Hello from the WorkQueue" }
 => [#<Thread:0x000000010079a8 sleep>] 
1.9.3p194 :007 > wq.enqueue_b { raise "Hello from the WorkQueue" }
 => nil 

(In my specific case, just printing the error and trace to the terminal is the most helpful approach)

As of version 2.5.4 the exceptions from enqueued threads are now printed to STDERR.