lib/daywalker/base.rb in technicalpickles-daywalker-0.1.2 vs lib/daywalker/base.rb in technicalpickles-daywalker-0.2.0

- old
+ new

@@ -5,11 +5,11 @@ protected def self.handle_response(response) case response.code.to_i - when 403 then raise BadApiKey + when 403 then raise BadApiKeyError when 200 begin parse(response.body) rescue => e raise "Error while parsing #{response.body.inspect} => #{e.inspect}" @@ -19,9 +19,12 @@ else raise "Don't know how to handle code #{response.code.inspect}" end end def self.handle_bad_request(body) - raise "Don't know how to handle #{body.inspect}" + case body + when "No Such Object Exists" then raise NotFoundError + else raise "Don't know how to handle #{body.inspect}" + end end end end