Exception: Shaf::Errors::NotFoundError
- Inherits:
-
ServerError
- Object
- StandardError
- Shaf::Error
- ServerError
- Shaf::Errors::NotFoundError
- Defined in:
- lib/shaf/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#clazz ⇒ Object
readonly
Returns the value of attribute clazz.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Attributes inherited from ServerError
Instance Method Summary collapse
- #http_status ⇒ Object
-
#initialize(msg = nil, clazz: nil, id: nil) ⇒ NotFoundError
constructor
A new instance of NotFoundError.
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
#clazz ⇒ Object (readonly)
Returns the value of attribute clazz.
53 54 55 |
# File 'lib/shaf/errors.rb', line 53 def clazz @clazz end |
#id ⇒ Object (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_status ⇒ Object
55 56 57 |
# File 'lib/shaf/errors.rb', line 55 def http_status 404 end |