>> If there is nothing but function calls between "begin" and "rescue", e.g. if
>> the entire executable block lies there, this should do it.
> 
> You should put this begin...rescue...end around each thread body you
> start, unless you set
> Thread.abort_on_exception = true. Otherwise exceptions in other
> threads might get lost.
> 
> Finally I'll mention that rescue without parameter rescues only
> StandardError, and therefore doesn't catch all Exceptions.

If you need more verbose output on unhandled exceptions (i.e. yours says
file1.rb:72
 file1.rb:70
 .... 20 lines ...
file3.rb:70

and you want all the exception lines, i think this code snippet does the 
trick.

Thread.abort_on_exception = true # dangerous, I know
class Thread
 alias init_old initialize
 def initialize *args, &block
  begin
        init_old args, &block
  rescue Exception => detail
        print "rescued an uncaught exception!"
        print detail.backtrace.join("\n")
  end
 end
end

-Roger
-- 
Posted via http://www.ruby-forum.com/.