Exception: JSONAPI::Exceptions::RecordNotFound

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(id, error_object_overrides = {}) ⇒ RecordNotFound

Returns a new instance of RecordNotFound.



89
90
91
92
# File 'lib/jsonapi/exceptions.rb', line 89

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

Instance Attribute Details

#idObject

Returns the value of attribute id.



87
88
89
# File 'lib/jsonapi/exceptions.rb', line 87

def id
  @id
end

Instance Method Details

#errorsObject



94
95
96
97
98
99
100
101
# File 'lib/jsonapi/exceptions.rb', line 94

def errors
  [create_error_object(code: JSONAPI::RECORD_NOT_FOUND,
                       status: :not_found,
                       title: I18n.translate('jsonapi-resources.exceptions.record_not_found.title',
                                             default: 'Record not found'),
                       detail: I18n.translate('jsonapi-resources.exceptions.record_not_found.detail',
                                              default: "The record identified by #{id} could not be found.", id: id))]
end