Exception: BrainzLab::NotFoundError
- Defined in:
- lib/brainzlab/errors.rb
Overview
Raised when a requested resource is not found.
Constant Summary
Constants inherited from Error
Instance Attribute Summary collapse
-
#resource_id ⇒ String?
readonly
The identifier of the resource that was not found.
-
#resource_type ⇒ String?
readonly
The type of resource that was not found.
Attributes inherited from Error
#code, #context, #docs_url, #hint
Instance Method Summary collapse
-
#initialize(message = nil, hint: nil, docs_url: nil, code: nil, context: nil, resource_type: nil, resource_id: nil) ⇒ NotFoundError
constructor
A new instance of NotFoundError.
Methods inherited from Error
#as_json, #detailed_message, #inspect, #to_h, #to_s
Constructor Details
#initialize(message = nil, hint: nil, docs_url: nil, code: nil, context: nil, resource_type: nil, resource_id: nil) ⇒ NotFoundError
Returns a new instance of NotFoundError.
251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/brainzlab/errors.rb', line 251 def initialize( = nil, hint: nil, docs_url: nil, code: nil, context: nil, resource_type: nil, resource_id: nil) @resource_type = resource_type @resource_id = resource_id code ||= 'not_found' context ||= {} context[:resource_type] = resource_type if resource_type context[:resource_id] = resource_id if resource_id super(, hint: hint, docs_url: docs_url, code: code, context: context.empty? ? nil : context) end |
Instance Attribute Details
#resource_id ⇒ String? (readonly)
Returns The identifier of the resource that was not found.
249 250 251 |
# File 'lib/brainzlab/errors.rb', line 249 def resource_id @resource_id end |
#resource_type ⇒ String? (readonly)
Returns The type of resource that was not found.
246 247 248 |
# File 'lib/brainzlab/errors.rb', line 246 def resource_type @resource_type end |