Exception: Shamu::NotFoundError

Inherits:
Error
  • Object
show all
Defined in:
lib/shamu/error.rb

Overview

The resource was not found.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = :not_found, id: :not_set, resource: :not_set) ⇒ NotFoundError

Returns a new instance of NotFoundError.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/shamu/error.rb', line 23

def initialize( message = :not_found, id: :not_set, resource: :not_set )
  @id = id
  @resource = resource

  if message == :not_found
    message =
      if id != :not_set
        if resource != :not_set
          :resource_not_found_with_id
        else
          :not_found_with_id
        end
      elsif resource != :not_set
        :resource_not_found
      else
        :not_found
      end
  end

  super translate( message, id: id, resource: resource )
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



20
21
22
# File 'lib/shamu/error.rb', line 20

def id
  @id
end

#resourceObject (readonly)

Returns the value of attribute resource.



21
22
23
# File 'lib/shamu/error.rb', line 21

def resource
  @resource
end