class OFlow::Actors::ErrorHandler

The default error handler.

Public Class Methods

new(task, options={}) click to toggle source
Calls superclass method OFlow::Actor::new
# File lib/oflow/actors/errorhandler.rb, line 8
def initialize(task, options={})
  super
end

Public Instance Methods

perform(op, box) click to toggle source

Open the box, form a reasonable message, then log that message. @param op [Symbol] ignores @param box [Box] data associated with the error

# 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.message}"]
  e.backtrace.each { |line| msg << ('    ' + line) }
  task.log_msg(:error, msg.join("\n"), where)
end
with_own_thread() click to toggle source

Handle error immediately.

# File lib/oflow/actors/errorhandler.rb, line 26
def with_own_thread()
  false
end