Exception: Rubino::NotFoundError

Inherits:
Error
  • Object
show all
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

Instance Method Summary collapse

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

#idObject (readonly)

Returns the value of attribute id.



37
38
39
# File 'lib/rubino/errors.rb', line 37

def id
  @id
end

#resourceObject (readonly)

Returns the value of attribute resource.



37
38
39
# File 'lib/rubino/errors.rb', line 37

def resource
  @resource
end