Class: OFlow::Actors::ErrorHandler
- Inherits:
-
OFlow::Actor
- Object
- OFlow::Actor
- OFlow::Actors::ErrorHandler
- Defined in:
- lib/oflow/actors/errorhandler.rb
Overview
The default error handler.
Instance Attribute Summary
Attributes inherited from OFlow::Actor
Instance Method Summary collapse
-
#initialize(task, options = {}) ⇒ ErrorHandler
constructor
A new instance of ErrorHandler.
-
#perform(op, box) ⇒ Object
Open the box, form a reasonable message, then log that message.
-
#with_own_thread ⇒ Object
Handle error immediately.
Methods inherited from OFlow::Actor
#busy?, #inputs, #options, #outputs, #set_option
Constructor Details
#initialize(task, options = {}) ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
8 9 10 |
# File 'lib/oflow/actors/errorhandler.rb', line 8 def initialize(task, ={}) super end |
Instance Method Details
#perform(op, box) ⇒ Object
Open the box, form a reasonable message, then log that message.
15 16 17 18 19 20 21 22 23 |
# File 'lib/oflow/actors/errorhandler.rb', line 15 def perform(op, box) contents = box.contents return task.error(contents.to_s) unless contents.is_a?(Array) e, where = contents task.error(e.to_s) unless e.is_a?(Exception) msg = ["#{e.class}: #{e.}"] e.backtrace.each { |line| msg << (' ' + line) } task.log_msg(:error, msg.join("\n"), where) end |
#with_own_thread ⇒ Object
Handle error immediately.
26 27 28 |
# File 'lib/oflow/actors/errorhandler.rb', line 26 def with_own_thread() false end |