Sha256: ca2c88697c2663cf8186895a0b05156b4ca050d298ef2e4f007951bfbcbadb6b

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

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 < 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.
  class ParseProtocolError < ParseError
    attr_accessor :code
    attr_accessor :error
    attr_accessor :response

    def initialize(response)
      @response = response
      @code = response["code"]
      @error = response["error"]

      super("#{@code}: #{@error}")
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parse-ruby-client-0.1.10 lib/parse/error.rb
parse-ruby-client-0.1.9 lib/parse/error.rb