lib/jflow/activity/task.rb in jflow-0.4.5 vs lib/jflow/activity/task.rb in jflow-0.5.0

- old
+ new

@@ -89,10 +89,21 @@ reason: reason, details: truncate(YAML.dump_stream(converted_exception, exception.backtrace), MAX_DETAILS_SIZE) ) end + def handle_exception(exception) + JFlow.configuration.error_handlers.each do |error_handler| + begin + error_handler.call(exception) + rescue => e + log_error("Error handler failed!") + log_error(e.backtrace.join("\n")) unless e.backtrace.nil? + end + end + end + private def retryable?(exception) !definition_options[:exceptions_to_exclude].include?(exception.class) end @@ -110,9 +121,13 @@ .swf_client end def log(str) JFlow.configuration.logger.info "[#{Thread.current.object_id}] #{str}" + end + + def log_error(str) + JFlow.configuration.logger.error "[#{Thread.current.object_id}] #{str}" end end end end