Class: Message::Filters::ErrorHandling
- Inherits:
-
Object
- Object
- Message::Filters::ErrorHandling
- Defined in:
- lib/message/filters/error_handling.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
Instance Method Summary collapse
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
4 5 6 |
# File 'lib/message/filters/error_handling.rb', line 4 def callback @callback end |
Instance Method Details
#call(filter, job, action) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/message/filters/error_handling.rb', line 6 def call(filter, job, action) lambda do |msg| begin filter.call(msg) rescue => e job_name = job.name rescue 'unknown job(find job name failed)' Message.log(:error) {"#{action} #{job_name} message failed, #{e.class}: #{e.}\n#{e.backtrace.join("\n")}"} if self.callback self.callback.call(e, msg, job, action) end end end end |