Exception: Common::Exceptions::InvalidFieldValue

Inherits:
BaseError
  • Object
show all
Defined in:
lib/common/exceptions/invalid_field_value.rb

Overview

InvalidFieldValue - field value is invalid

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseError

#i18n_data, #i18n_field, #i18n_interpolated, #i18n_key, #log_to_sentry?, #message, #sentry_type, #status_code

Constructor Details

#initialize(field, value) ⇒ InvalidFieldValue

Returns a new instance of InvalidFieldValue.



12
13
14
15
# File 'lib/common/exceptions/invalid_field_value.rb', line 12

def initialize(field, value)
  @field = field
  @value = value
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



10
11
12
# File 'lib/common/exceptions/invalid_field_value.rb', line 10

def field
  @field
end

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/common/exceptions/invalid_field_value.rb', line 10

def value
  @value
end

Instance Method Details

#errorsObject



17
18
19
# File 'lib/common/exceptions/invalid_field_value.rb', line 17

def errors
  Array(SerializableError.new(i18n_interpolated(detail: { field: @field, value: @value })))
end