Exception: Smith::Workflow::Composite::BranchFailure

Inherits:
Smith::WorkflowError show all
Defined in:
lib/smith/workflow/composite/branch_failure.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(branch_key:, error:) ⇒ BranchFailure

Returns a new instance of BranchFailure.



68
69
70
71
72
73
74
# File 'lib/smith/workflow/composite/branch_failure.rb', line 68

def initialize(branch_key:, error:)
  validate_arguments!(branch_key, error)
  @branch_key = branch_key.dup.freeze
  copy_error_attributes(error)
  @details = failure_details
  super("composite branch #{branch_key.inspect} failed")
end

Instance Attribute Details

#branch_keyObject (readonly)

Returns the value of attribute branch_key.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def branch_key
  @branch_key
end

#detailsObject (readonly)

Returns the value of attribute details.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def details
  @details
end

#error_classObject (readonly)

Returns the value of attribute error_class.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def error_class
  @error_class
end

#error_familyObject (readonly)

Returns the value of attribute error_family.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def error_family
  @error_family
end

#kindObject (readonly)

Returns the value of attribute kind.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def kind
  @kind
end

#reasonObject (readonly)

Returns the value of attribute reason.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def reason
  @reason
end

#retryableObject (readonly)

Returns the value of attribute retryable.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def retryable
  @retryable
end

#tool_nameObject (readonly)

Returns the value of attribute tool_name.



24
25
26
# File 'lib/smith/workflow/composite/branch_failure.rb', line 24

def tool_name
  @tool_name
end

Class Method Details

.from_details(details) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/smith/workflow/composite/branch_failure.rb', line 26

def self.from_details(details)
  values = normalize_details(details)
  error_attributes = {
    class_name: values.fetch(:error_class),
    family: values.fetch(:error_family),
    retryable: values.fetch(:retryable),
    kind: values.fetch(:kind)
  }
  OPTIONAL_DETAIL_NAMES.each do |name|
    error_attributes[name] = values[name] if values.key?(name)
  end
  error = Error.new(error_attributes)
  new(branch_key: values.fetch(:branch_key), error:)
end