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.



553
554
555
556
557
# File 'lib/jsonapi/exceptions.rb', line 553

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.



551
552
553
# File 'lib/jsonapi/exceptions.rb', line 551

def page
  @page
end

#valueObject

Returns the value of attribute value.



551
552
553
# File 'lib/jsonapi/exceptions.rb', line 551

def value
  @value
end

Instance Method Details

#errorsObject



559
560
561
562
563
564
565
566
567
# File 'lib/jsonapi/exceptions.rb', line 559

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