Exception: JSONAPI::Exceptions::InvalidFilterValue

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

Instance Attribute Summary collapse

Attributes inherited from Error

#error_object_overrides

Instance Method Summary collapse

Methods inherited from Error

#create_error_object

Constructor Details

#initialize(filter, value, error_object_overrides = {}) ⇒ InvalidFilterValue

Returns a new instance of InvalidFilterValue.



222
223
224
225
226
# File 'lib/jsonapi/exceptions.rb', line 222

def initialize(filter, value, error_object_overrides = {})
  @filter = filter
  @value = value
  super(error_object_overrides)
end

Instance Attribute Details

#filterObject

Returns the value of attribute filter.



220
221
222
# File 'lib/jsonapi/exceptions.rb', line 220

def filter
  @filter
end

#valueObject

Returns the value of attribute value.



220
221
222
# File 'lib/jsonapi/exceptions.rb', line 220

def value
  @value
end

Instance Method Details

#errorsObject



228
229
230
231
232
233
234
235
236
# File 'lib/jsonapi/exceptions.rb', line 228

def errors
  [create_error_object(code: JSONAPI::INVALID_FILTER_VALUE,
                       status: :bad_request,
                       title: I18n.translate('jsonapi-resources.exceptions.invalid_filter_value.title',
                                             default: 'Invalid filter value'),
                       detail: I18n.translate('jsonapi-resources.exceptions.invalid_filter_value.detail',
                                              default: "#{value} is not a valid value for #{filter}.",
                                              value: value, filter: filter))]
end