Exception: Rubino::NotFoundError
- Defined in:
- lib/rubino/errors.rb
Overview
Resource not found. Maps to 404.
Footgun: ‘raise NotFoundError, “foo”` skips this initializer (Ruby passes the string straight to StandardError#initialize), so @resource/@id stay nil. Always use `raise NotFoundError.new(“Session”, id)` to capture them.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(resource, id = nil) ⇒ NotFoundError
constructor
A new instance of NotFoundError.
Constructor Details
#initialize(resource, id = nil) ⇒ NotFoundError
Returns a new instance of NotFoundError.
31 32 33 34 35 36 |
# File 'lib/rubino/errors.rb', line 31 def initialize(resource, id = nil) msg = id ? "#{resource} not found: #{id}" : "#{resource} not found" super(msg) @resource = resource @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
37 38 39 |
# File 'lib/rubino/errors.rb', line 37 def id @id end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
37 38 39 |
# File 'lib/rubino/errors.rb', line 37 def resource @resource end |