Exception: PriceHubble::EntityNotFound

Inherits:
EntityError
  • Object
show all
Defined in:
lib/price_hubble/errors.rb

Overview

Raised when an entity was not found while searching/getting.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, entity = nil, criteria = {}) ⇒ EntityNotFound

Create a new instance of the error.

Parameters:

  • message (String) (defaults to: nil)

    the error message

  • entity (PriceHubble::BaseEntity) (defaults to: nil)

    the entity which was not found

  • criteria (Hash{Symbol => Mixed}) (defaults to: {})

    the search/find criteria



36
37
38
39
40
41
42
# File 'lib/price_hubble/errors.rb', line 36

def initialize(message = nil, entity = nil, criteria = {})
  @entity = entity
  @criteria = criteria
  message ||= "Couldn't find #{entity} with #{criteria.inspect}"

  super(message)
end

Instance Attribute Details

#criteriaObject (readonly)

Returns the value of attribute criteria.



29
30
31
# File 'lib/price_hubble/errors.rb', line 29

def criteria
  @criteria
end

#entityObject (readonly)

Returns the value of attribute entity.



29
30
31
# File 'lib/price_hubble/errors.rb', line 29

def entity
  @entity
end