Exception: Parse::ParseProtocolError
- Inherits:
-
ParseError
- Object
- StandardError
- ParseError
- Parse::ParseProtocolError
- Defined in:
- lib/parse/error.rb
Overview
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.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#error ⇒ Object
Returns the value of attribute error.
-
#http_status_code ⇒ Object
Returns the value of attribute http_status_code.
-
#message ⇒ Object
writeonly
Sets the attribute message.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ ParseProtocolError
constructor
A new instance of ParseProtocolError.
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ ParseProtocolError
Returns a new instance of ParseProtocolError.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/parse/error.rb', line 19 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 |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
14 15 16 |
# File 'lib/parse/error.rb', line 14 def code @code end |
#error ⇒ Object
Returns the value of attribute error.
15 16 17 |
# File 'lib/parse/error.rb', line 15 def error @error end |
#http_status_code ⇒ Object
Returns the value of attribute http_status_code.
17 18 19 |
# File 'lib/parse/error.rb', line 17 def http_status_code @http_status_code end |
#message=(value) ⇒ Object (writeonly)
Sets the attribute message
34 35 36 |
# File 'lib/parse/error.rb', line 34 def (value) @message = value end |
#response ⇒ Object
Returns the value of attribute response.
16 17 18 |
# File 'lib/parse/error.rb', line 16 def response @response end |
Instance Method Details
#to_s ⇒ Object
30 31 32 |
# File 'lib/parse/error.rb', line 30 def to_s @message || super end |