Exception: Shaf::Errors::NotFoundError

Inherits:
ServerError
  • Object
show all
Defined in:
lib/shaf/errors.rb

Instance Attribute Summary collapse

Attributes inherited from ServerError

#code, #title

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, clazz: nil, id: nil) ⇒ NotFoundError

Returns a new instance of NotFoundError.



57
58
59
60
61
62
# File 'lib/shaf/errors.rb', line 57

def initialize(msg = nil, clazz: nil, id: nil)
  @clazz = clazz
  @id = id
  msg ||= "#{clazz ? "#{clazz.to_s} r" : "R"}esource with id #{id} does not exist"
  super(msg, code: "RESOURCE_NOT_FOUND", title: "Resource not found")
end

Instance Attribute Details

#clazzObject (readonly)

Returns the value of attribute clazz.



51
52
53
# File 'lib/shaf/errors.rb', line 51

def clazz
  @clazz
end

#idObject (readonly)

Returns the value of attribute id.



51
52
53
# File 'lib/shaf/errors.rb', line 51

def id
  @id
end

Instance Method Details

#http_statusObject



53
54
55
# File 'lib/shaf/errors.rb', line 53

def http_status
  404
end