Module: ActiveWorker::Behavior::CreateFromError

Included in:
FailureEvent, ParentEvent
Defined in:
lib/active_worker/behavior/create_from_error.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



5
6
7
8
# File 'lib/active_worker/behavior/create_from_error.rb', line 5

def self.extended(base)
  base.field :stack_trace
  base.field :error_type
end

Instance Method Details

#create_error_from_configuration(configuration, error) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/active_worker/behavior/create_from_error.rb', line 10

def create_error_from_configuration(configuration, error)
  constructor_options = {
      :message => "#{configuration.event_name} FAILED: #{error.message}",
      :stack_trace => error.backtrace.join("\n"),
      :configuration => configuration,
      :error_type => error.class.name
  }
  create! constructor_options
end