Exception: PgVerify::Interpret::NoSuchStateError

Inherits:
Core::Error
  • Object
show all
Defined in:
lib/pg-verify/interpret/interpret.rb

Instance Method Summary collapse

Methods inherited from Core::Error

#to_formatted

Constructor Details

#initialize(state, component) ⇒ NoSuchStateError

Returns a new instance of NoSuchStateError.



114
115
116
# File 'lib/pg-verify/interpret/interpret.rb', line 114

def initialize(state, component)
    @state, @component = state, component
end

Instance Method Details

#formattedObject



117
118
119
120
121
122
123
# File 'lib/pg-verify/interpret/interpret.rb', line 117

def formatted()
    title = "No such state #{@state} in component #{@component.name}"
    body = "The component #{@component.name.to_s.c_cmp} does not contain a state called #{@state.to_s.c_state}.\n"
    body += "Available states are: #{@component.states&.map(&:to_s)&.map(&:c_state)&.join(', ')}"
    hint = "Make sure to define states before defining transitions."
    return title, body, hint
end