Exception: StatesLanguageMachine::ExecutionError

Inherits:
Error
  • Object
show all
Defined in:
lib/ruby_slm/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state_name, cause) ⇒ ExecutionError

Returns a new instance of ExecutionError.

Parameters:

  • state_name (String)

    the name of the state where the error occurred

  • cause (String)

    the cause of the error



14
15
16
17
18
# File 'lib/ruby_slm/errors.rb', line 14

def initialize(state_name, cause)
  @state_name = state_name
  @cause = cause
  super("Execution failed in state '#{state_name}': #{cause}")
end

Instance Attribute Details

#causeString (readonly)

Returns the cause of the error.

Returns:

  • (String)

    the cause of the error



10
11
12
# File 'lib/ruby_slm/errors.rb', line 10

def cause
  @cause
end

#state_nameString (readonly)

Returns the name of the state where the error occurred.

Returns:

  • (String)

    the name of the state where the error occurred



8
9
10
# File 'lib/ruby_slm/errors.rb', line 8

def state_name
  @state_name
end