Module: Robustly::Methods
- Defined in:
- lib/robustly.rb
Instance Method Summary collapse
- #safely(options = {}, &block) ⇒ Object (also: #yolo, #robustly)
Instance Method Details
#safely(options = {}, &block) ⇒ Object Also known as: yolo, robustly
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/robustly.rb', line 20 def safely( = {}, &block) class_names = Array([:only] || StandardError) begin yield rescue *class_names => e raise e if %w[development test].include?(Robustly.env) if [:throttle] ? rand < 1.0 / [:throttle] : true Robustly.report_exception(e) end [:default] end end |