Exception: Common::Exceptions::RecordNotFound
- Defined in:
- lib/common/exceptions/record_not_found.rb
Overview
Record Not Found - if no record exists having id, or resource having id does not belong to requester
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(id, detail: nil) ⇒ RecordNotFound
constructor
A new instance of RecordNotFound.
Methods inherited from BaseError
#i18n_data, #i18n_field, #i18n_interpolated, #i18n_key, #log_to_sentry?, #message, #sentry_type, #status_code
Constructor Details
#initialize(id, detail: nil) ⇒ RecordNotFound
Returns a new instance of RecordNotFound.
12 13 14 15 |
# File 'lib/common/exceptions/record_not_found.rb', line 12 def initialize(id, detail: nil) @id = id @detail = detail end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/common/exceptions/record_not_found.rb', line 10 def id @id end |
Instance Method Details
#errors ⇒ Object
17 18 19 20 |
# File 'lib/common/exceptions/record_not_found.rb', line 17 def errors detail = @detail.presence || { id: @id } Array(SerializableError.new(i18n_interpolated(detail:))) end |