Exception: Structify::MissingFieldError

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

Overview

Error raised when trying to access a field that doesn’t exist in the record’s version

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field_name, record_version, schema_version) ⇒ MissingFieldError

Returns a new instance of MissingFieldError.



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/structify.rb', line 56

def initialize(field_name, record_version, schema_version)
  @field_name = field_name
  @record_version = record_version
  @schema_version = schema_version
  
  message = "Field '#{field_name}' does not exist in version #{record_version}. " \
            "It was introduced in version #{schema_version}. " \
            "To access this field, upgrade the record by setting new field values and saving."
  
  super(message)
end

Instance Attribute Details

#field_nameObject (readonly)

Returns the value of attribute field_name.



54
55
56
# File 'lib/structify.rb', line 54

def field_name
  @field_name
end

#record_versionObject (readonly)

Returns the value of attribute record_version.



54
55
56
# File 'lib/structify.rb', line 54

def record_version
  @record_version
end

#schema_versionObject (readonly)

Returns the value of attribute schema_version.



54
55
56
# File 'lib/structify.rb', line 54

def schema_version
  @schema_version
end