class LC::LCProtocolError

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.

Attributes

code[RW]
error[RW]
http_status_code[RW]
response[RW]

Public Class Methods

new(response) click to toggle source
Calls superclass method
# File lib/leancloud/error.rb, line 18
def initialize(response)
  @response = response
  if response
    @code   = response["code"]
    @error  = response["error"]
    @http_status_code = response["http_status_code"]
  end

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

Public Instance Methods

message=(msg) click to toggle source
# File lib/leancloud/error.rb, line 33
def message=(msg)
  @message = msg
end
to_s() click to toggle source
Calls superclass method
# File lib/leancloud/error.rb, line 29
def to_s
  @message || super
end