Exception: Shaf::Errors::NotFoundError

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

Direct Known Subclasses

Profiles::ProfileNotFoundError

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.



59
60
61
62
63
64
# File 'lib/shaf/errors.rb', line 59

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.



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

def clazz
  @clazz
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

Instance Method Details

#http_statusObject



55
56
57
# File 'lib/shaf/errors.rb', line 55

def http_status
  404
end