class Statefully::Errors::StateMissing

StateMissing represents an error being thrown when a member of {State} is being accessed using an unsafe accessor (eg. member!). It is technically a NoMethodError, but it is introduced to allow users to differentiate between failing state accessors and other code that may fail in a similar way.

Attributes

field[R]

Stores the name of the missing {State} field

@return [Symbol] the name of the field. @api public @example

Statefully::Errors::StateMissing.new(:bacon).field
=> :bacon

Public Class Methods

new(field) click to toggle source

Error constructor for {StateMissing}

@param field [Symbol] name of the missing field. @api public @example

Statefully::Errors::StateMissing.new(:bacon)
=> #<Statefully::Errors::StateMissing: field 'bacon' missing from state>
Calls superclass method
# File lib/statefully/errors.rb, line 26
def initialize(field)
  @field = field
  super("field '#{field}' missing from state")
end