Exception: Parse::Error::CloudCodeError

Inherits:
Parse::Error
  • Object
show all
Defined in:
lib/parse/client.rb

Overview

An error raised when a cloud function or job returns an error response (e.g. when the cloud code calls error!()). Carries the function name, Parse error code, HTTP status, and the underlying Response for debugging.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function_name, response) ⇒ CloudCodeError

Returns a new instance of CloudCodeError.



68
69
70
71
72
73
74
# File 'lib/parse/client.rb', line 68

def initialize(function_name, response)
  @function_name = function_name
  @response = response
  @code = response.code
  @http_status = response.http_status
  super("Parse cloud function `#{function_name}` failed: [#{@code}] #{response.error} (HTTP #{@http_status})")
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



66
67
68
# File 'lib/parse/client.rb', line 66

def code
  @code
end

#function_nameObject (readonly)

Returns the value of attribute function_name.



66
67
68
# File 'lib/parse/client.rb', line 66

def function_name
  @function_name
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



66
67
68
# File 'lib/parse/client.rb', line 66

def http_status
  @http_status
end

#responseObject (readonly)

Returns the value of attribute response.



66
67
68
# File 'lib/parse/client.rb', line 66

def response
  @response
end

Instance Method Details

#inspectObject



76
77
78
# File 'lib/parse/client.rb', line 76

def inspect
  "#<#{self.class} function=#{@function_name.inspect} code=#{@code.inspect} http_status=#{@http_status.inspect}>"
end