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.



60
61
62
63
64
65
66
67
68
69
# File 'lib/smith/workflow/composite/branch_failure.rb', line 60

def initialize(branch_key:, error:)
  validate_arguments!(branch_key, error)
  @branch_key = branch_key.dup.freeze
  @error_class = error.class_name.dup.freeze
  @error_family = error.family.dup.freeze
  @retryable = error.retryable
  @kind = error.kind&.dup&.freeze
  @details = failure_details
  super("composite branch #{branch_key.inspect} failed")
end

Instance Attribute Details

#branch_keyObject (readonly)

Returns the value of attribute branch_key.



20
21
22
# File 'lib/smith/workflow/composite/branch_failure.rb', line 20

def branch_key
  @branch_key
end

#detailsObject (readonly)

Returns the value of attribute details.



20
21
22
# File 'lib/smith/workflow/composite/branch_failure.rb', line 20

def details
  @details
end

#error_classObject (readonly)

Returns the value of attribute error_class.



20
21
22
# File 'lib/smith/workflow/composite/branch_failure.rb', line 20

def error_class
  @error_class
end

#error_familyObject (readonly)

Returns the value of attribute error_family.



20
21
22
# File 'lib/smith/workflow/composite/branch_failure.rb', line 20

def error_family
  @error_family
end

#kindObject (readonly)

Returns the value of attribute kind.



20
21
22
# File 'lib/smith/workflow/composite/branch_failure.rb', line 20

def kind
  @kind
end

#retryableObject (readonly)

Returns the value of attribute retryable.



20
21
22
# File 'lib/smith/workflow/composite/branch_failure.rb', line 20

def retryable
  @retryable
end

Class Method Details

.from_details(details) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/smith/workflow/composite/branch_failure.rb', line 22

def self.from_details(details)
  values = normalize_details(details)
  error = Error.new(
    class_name: values.fetch(:error_class),
    family: values.fetch(:error_family),
    retryable: values.fetch(:retryable),
    kind: values.fetch(:kind)
  )
  new(branch_key: values.fetch(:branch_key), error:)
end