Exception: Parse::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/parse/model/core/errors.rb,
lib/parse/stack.rb,
lib/parse/client.rb,
lib/parse/model/classes/user.rb

Overview

An abstract parent class for all Parse::Error types.

Supports both legacy single-argument construction (‘raise Parse::Error, “msg”`) and two-argument construction with a Parse error code (`raise Parse::Error.new(code, “msg”)`). When a code is provided it is exposed via #code and prefixed onto the message.

Defined Under Namespace

Classes: AuthenticationError, CloudCodeError, ConnectionError, EmailMissing, EmailNotFound, EmailTakenError, InvalidEmailAddress, InvalidSessionTokenError, PasswordMissingError, ProtocolError, RequestLimitExceededError, ServerError, ServiceUnavailableError, TimeoutError, UsernameMissingError, UsernameTakenError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code_or_message = nil, message = nil) ⇒ Error

Returns a new instance of Error.



16
17
18
19
20
21
22
23
# File 'lib/parse/model/core/errors.rb', line 16

def initialize(code_or_message = nil, message = nil)
  if message.nil?
    super(code_or_message)
  else
    @code = code_or_message
    super("[#{code_or_message}] #{message}")
  end
end

Instance Attribute Details

#codeInteger, ... (readonly)

Returns the Parse error code when constructed with one.

Returns:

  • (Integer, String, nil)

    the Parse error code when constructed with one.



14
15
16
# File 'lib/parse/model/core/errors.rb', line 14

def code
  @code
end