Exception: Smith::ToolCaptureFailed

Inherits:
Error
  • Object
show all
Defined in:
lib/smith/tool_capture_failed.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tool_name:, reason:) ⇒ ToolCaptureFailed

Returns a new instance of ToolCaptureFailed.



20
21
22
23
24
# File 'lib/smith/tool_capture_failed.rb', line 20

def initialize(tool_name:, reason:)
  @tool_name = normalize_tool_name(tool_name)
  @reason = normalize_reason(reason)
  super("strict result capture failed for #{@tool_name}: #{@reason}")
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



18
19
20
# File 'lib/smith/tool_capture_failed.rb', line 18

def reason
  @reason
end

#tool_nameObject (readonly)

Returns the value of attribute tool_name.



18
19
20
# File 'lib/smith/tool_capture_failed.rb', line 18

def tool_name
  @tool_name
end

Class Method Details

.for_runtime(tool_name:, reason:) ⇒ Object



35
36
37
38
39
# File 'lib/smith/tool_capture_failed.rb', line 35

def self.for_runtime(tool_name:, reason:)
  new(tool_name:, reason:)
rescue ArgumentError
  new(tool_name: diagnostic_tool_name(tool_name), reason:)
end

.from_details(details) ⇒ Object



30
31
32
33
# File 'lib/smith/tool_capture_failed.rb', line 30

def self.from_details(details)
  values = normalize_details(details)
  new(tool_name: values.fetch(:tool_name), reason: values.fetch(:reason))
end

Instance Method Details

#detailsObject



26
27
28
# File 'lib/smith/tool_capture_failed.rb', line 26

def details
  { tool_name:, reason: }.freeze
end