Module: Atig::ExceptionUtil
- Included in:
- Util
- Defined in:
- lib/atig/exception_util.rb
Class Method Summary collapse
Class Method Details
.daemon(&f) ⇒ Object
18 19 20 21 22 |
# File 'lib/atig/exception_util.rb', line 18 def daemon(&f) Thread.new do loop{ safe { f.call }} end end |
.safe(&f) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/atig/exception_util.rb', line 5 def safe(&f) begin f.call rescue Exception => e s = e.inspect + "\n" e.backtrace.each do |l| s += "\t#{l}\n" end log :error,s end end |