Method: OFlow::Actors::ErrorHandler#perform

Defined in:
lib/oflow/actors/errorhandler.rb

#perform(op, box) ⇒ Object

Open the box, form a reasonable message, then log that message.

Parameters:

  • op (Symbol)

    ignores

  • box (Box)

    data associated with the error



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