Class: SpotFlow::Bpmn::ErrorEventDefinition

Inherits:
EventDefinition show all
Defined in:
lib/spot_flow/bpmn/event_definition.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#extension_elements, #id, #name

Instance Method Summary collapse

Methods inherited from Element

#inspect

Constructor Details

#initialize(attributes = {}) ⇒ ErrorEventDefinition

Returns a new instance of ErrorEventDefinition.



29
30
31
32
33
34
35
# File 'lib/spot_flow/bpmn/event_definition.rb', line 29

def initialize(attributes = {})
  super(attributes.except(:error_ref, :error_code_variable, :error_message_variable))

  @error_ref = attributes[:error_ref]
  @error_code_variable = attributes[:error_code_variable]
  @error_message_variable = attributes[:error_message_variable]
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



26
27
28
# File 'lib/spot_flow/bpmn/event_definition.rb', line 26

def error
  @error
end

#error_code_variableObject

Returns the value of attribute error_code_variable.



27
28
29
# File 'lib/spot_flow/bpmn/event_definition.rb', line 27

def error_code_variable
  @error_code_variable
end

#error_message_variableObject

Returns the value of attribute error_message_variable.



27
28
29
# File 'lib/spot_flow/bpmn/event_definition.rb', line 27

def error_message_variable
  @error_message_variable
end

#error_refObject

Returns the value of attribute error_ref.



26
27
28
# File 'lib/spot_flow/bpmn/event_definition.rb', line 26

def error_ref
  @error_ref
end

Instance Method Details

#error_idObject



45
46
47
# File 'lib/spot_flow/bpmn/event_definition.rb', line 45

def error_id
  error&.id
end

#error_nameObject



49
50
51
# File 'lib/spot_flow/bpmn/event_definition.rb', line 49

def error_name
  error&.name
end

#execute(execution) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/spot_flow/bpmn/event_definition.rb', line 37

def execute(execution)
  if execution.step.is_throwing?
    execution.throw_error(error_name)
  else
    execution.error_names.push error_name
  end
end