Exception: Parse::Webhooks::ResponseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/parse/webhooks.rb

Overview

The error to be raised in registered trigger or function webhook blocks that will trigger the Parse::Webhooks application to return the proper error response.

An optional numeric code is carried on the exception and written into the error body as "code". Note that Parse Server's HTTP webhook adapter (as of 9.10) reports every webhook error to the client as code 141 (SCRIPT_FAILED) and does not forward a custom code; the code remains visible to in-process callers such as run_function.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, code: nil) ⇒ ResponseError

Returns a new instance of ResponseError.

Parameters:

  • message (String) (defaults to: nil) —

    the error message.

  • code (Integer, nil) (defaults to: nil) —

    an optional Parse error code.



98
99
100
101
# File 'lib/parse/webhooks.rb', line 98

def initialize(message = nil, code: nil)
  super(message)
  @code = code
end

Instance Attribute Details

#code ⇒ Integer? (readonly)

Returns the Parse error code requested by the handler.

Returns:

  • (Integer, nil) —

    the Parse error code requested by the handler.



94
95
96
# File 'lib/parse/webhooks.rb', line 94

def code
  @code
end