Exception: Statefully::Errors::StateMissing
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Statefully::Errors::StateMissing
- Defined in:
- lib/statefully/errors.rb
Overview
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.
Instance Attribute Summary collapse
-
#field ⇒ Symbol
readonly
Stores the name of the missing State field.
Instance Method Summary collapse
-
#initialize(field) ⇒ StateMissing
constructor
Error constructor for StateMissing.
Constructor Details
#initialize(field) ⇒ StateMissing
Error constructor for Statefully::Errors::StateMissing
26 27 28 29 |
# File 'lib/statefully/errors.rb', line 26 def initialize(field) @field = field super("field '#{field}' missing from state") end |
Instance Attribute Details
#field ⇒ Symbol (readonly)
Stores the name of the missing State field
17 18 19 |
# File 'lib/statefully/errors.rb', line 17 def field @field end |