Sha256: 6822d3e50685870f3862075464ad8303b34b4d139115a7c110460c10d750c21b
Contents?: true
Size: 713 Bytes
Versions: 8
Compression:
Stored size: 713 Bytes
Contents
# Default exception handler. Just logs to the logger and re-raise # so the exception can be managed as usual. module SimplerWorkflow class DefaultExceptionReporter attr_accessor :reporter, :tag def initialize(&block) @reporter = block if block_given? end def report(e, context = {}) if reporter reporter.call(e, context) else SimplerWorkflow.logger.error("[#{tag}] Exception: #{e.message}") SimplerWorkflow.logger.error("[#{tag}] Context: #{context.inspect}") unless context.empty? SimplerWorkflow.logger.error("[#{tag}] Backtrace:\n#{e.backtrace.join("\n")}") end end def tag @tag || "SimplerWorkflow" end end end
Version data entries
8 entries across 8 versions & 1 rubygems