def handle (msg, fexp, exception)
wfid = msg['wfid'] || (msg['fei']['wfid'] rescue nil)
fei = msg['fei'] || (fexp.h.fei rescue nil)
backtrace = exception.backtrace || []
if $DEBUG || ARGV.include?('-d')
puts "\n== worker intercepted error =="
puts
p exception
puts backtrace[0, 20].join("\n")
puts "..."
puts
puts "-- msg --"
msg.keys.sort.each { |k|
puts " #{k.inspect} =>\n#{msg[k].inspect}"
}
puts "-- . --"
puts
end
return if fexp && fexp.handle_on_error(msg, exception)
@context.storage.put_msg(
'error_intercepted',
'error_class' => exception.class.name,
'error_message' => exception.message,
'error_backtrace' => exception.backtrace,
'message' => exception.inspect,
'wfid' => wfid,
'msg' => msg)
@context.storage.put(
'type' => 'errors',
'_id' => "err_#{Ruote.to_storage_id(fei)}",
'message' => exception.inspect,
'trace' => backtrace.join("\n"),
'fei' => fei,
'msg' => msg
) if fei
end