Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/error_log/core_ext.rb
Instance Method Summary collapse
-
#catch_error(category = 'catch_error', options = {}) ⇒ Object
Handy way to catch exceptions.
Instance Method Details
#catch_error(category = 'catch_error', options = {}) ⇒ Object
Handy way to catch exceptions
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/error_log/core_ext.rb', line 5 def catch_error(category='catch_error', ={}) raise "no block given!" unless block_given? begin yield return false rescue Exception => e ErrorLog.log([:level] || :error, e.to_str, :backtrace => e.backtrace, :params => [:params], :category => category) end end |