Exception: Caprese::RecordNotFoundError

Inherits:
Error
  • Object
show all
Defined in:
lib/caprese/errors.rb

Overview

Thrown when a record could not be found

Instance Attribute Summary

Attributes inherited from Error

#code, #field, #header, #t

Instance Method Summary collapse

Methods inherited from Error

#as_json, #i18n_scope, #with_header

Constructor Details

#initialize(model: nil, value: nil) ⇒ RecordNotFoundError

Returns a new instance of RecordNotFoundError.



43
44
45
46
# File 'lib/caprese/errors.rb', line 43

def initialize(model: nil, value: nil)
  super field: :id, code: :not_found, t: { model: model, value: value }
  @header = { status: :not_found }
end

Instance Method Details

#full_messageObject



48
49
50
# File 'lib/caprese/errors.rb', line 48

def full_message
  I18n.t("#{i18n_scope}.parameters.not_found", t)
end