class SimplerWorkflow::DefaultExceptionReporter
Attributes
reporter[RW]
tag[RW]
Public Class Methods
new(&block)
click to toggle source
# File lib/simpler_workflow/default_exception_reporter.rb, line 8 def initialize(&block) @reporter = block if block_given? end
Public Instance Methods
report(e, context = {})
click to toggle source
# File lib/simpler_workflow/default_exception_reporter.rb, line 12 def report(e, context = {}) reporter.call(e, context) if reporter ensure 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