lib/parse/error.rb in parse-ruby-client-0.0.2 vs lib/parse/error.rb in parse-ruby-client-0.0.3
- old
+ new
@@ -1,11 +1,11 @@
module Parse
# Base exception class for errors thrown by the Parse
# client library. ParseError will be raised by any
# network operation if Parse.init() has not been called.
- class ParseError < Exception
+ class ParseError < StandardError #Exception ... why? A:http://www.skorks.com/2009/09/ruby-exceptions-and-exception-handling/
end
# An exception class raised when the REST API returns an error.
# The error code and message will be parsed out of the HTTP response,
# which is also included in the response attribute.
@@ -13,15 +13,17 @@
attr_accessor :code
attr_accessor :error
attr_accessor :response
def initialize(response)
- @response = response
- if response.body
- data = JSON.parse response.body
- @code = data["code"]
- @message = data["error"]
- end
+ #@response = response
+ #if response.body
+ # data = JSON.parse response.body
+ # @code = data["code"]
+ # @message = data["error"]
+ #end
+
+ #{}"#{@code}: #{@message}"
end
end
end
\ No newline at end of file