Exception: JSONAPI::Exceptions::InvalidPageValue

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(page, value, error_object_overrides = {}) ⇒ InvalidPageValue

Returns a new instance of InvalidPageValue.



576
577
578
579
580
# File 'lib/jsonapi/exceptions.rb', line 576

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

Instance Attribute Details

#pageObject

Returns the value of attribute page.



574
575
576
# File 'lib/jsonapi/exceptions.rb', line 574

def page
  @page
end

#valueObject

Returns the value of attribute value.



574
575
576
# File 'lib/jsonapi/exceptions.rb', line 574

def value
  @value
end

Instance Method Details

#errorsObject



582
583
584
585
586
587
588
589
590
# File 'lib/jsonapi/exceptions.rb', line 582

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