views:

28

answers:

2

When I spawn a thread with Thread.new{} it looks like any exception that happens in that thread never sees the light of day, and the app just quietly ignores it

+1  A: 

Normally, threads are isolated from each other, so exception in one won't terminate the whole application.

But, although I never used them, Thread class has several abort_on_exception methods, even with some examples. They should do what you want.
http://corelib.rubyonrails.org/classes/Thread.html

Nikita Rybak
Awesome! thanks!
Tyler Gillies
A: 

Adding to Nikita's answer, you can also trigger the exception by calling thread.join on the thread you've generated.

If you run the program with the debug flag on (ruby -d), then you'll also abort when an unhandled exception is raised in a thread.

Andrew Grimm