Class: Frenetic::ResourceNotFound

Inherits:
ClientError
  • Object
show all
Defined in:
lib/frenetic/errors.rb

Overview

Raise when a network reponse returns a 404 Not Found error

Instance Method Summary collapse

Constructor Details

#initialize(resource, params) ⇒ ResourceNotFound

Returns a new instance of ResourceNotFound.



151
152
153
154
155
156
# File 'lib/frenetic/errors.rb', line 151

def initialize(resource, params)
  @resource = resource.to_s.demodulize
  @params = params
  @status = 404
  super(message)
end

Instance Method Details

#messageObject



158
159
160
161
162
163
164
# File 'lib/frenetic/errors.rb', line 158

def message
  if @params.blank?
    "Couldn't find #{@resource} without an ID"
  else
    "Couldn't find #{@resource} with #{stringified_params}"
  end
end