raise

thr.raise
thr.raise(string)
thr.raise(exception [, string [, array]])
Instance Public methods

Raises an exception (see Kernel::raise) from thr. The caller does not have to be thr.

1
2
3
Thread.abort_on_exception = true
a = Thread.new { sleep(200) }
a.raise("Gotcha")

produces:

1
2
3
4
prog.rb:3: Gotcha (RuntimeError)
 from prog.rb:2:in `initialize'
 from prog.rb:2:in `new'
 from prog.rb:2
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.