ErrorResponse
extends Response
in package
When a rpc call is made, the Server MUST reply with a Response, except for in the case of Notifications. The Response is expressed as a single JSON Object, with the following members:
Table of Contents
Properties
- $error : Error
- This member is REQUIRED on error. This member MUST NOT exist if there was no error triggered during invocation.
- $id : int|string
- This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
- $jsonrpc : string
- A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
Methods
- __construct() : mixed
- __toString() : string
- isErrorResponse() : bool
- A message is considered a Response if it has an ID and either a result or an error
- isResponse() : bool
- A message is considered a Response if it has an ID and either a result or an error
- parse() : Message
- Returns the appropriate Message subclass
Properties
$error
This member is REQUIRED on error. This member MUST NOT exist if there was no error triggered during invocation.
public
Error
$error
The value for this member MUST be an Object as defined in section 5.1.
$id
This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
public
int|string
$id
$jsonrpc
A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
public
string
$jsonrpc
= '2.0'
Methods
__construct()
public
__construct(int|string $id, Error $error) : mixed
Parameters
- $id : int|string
- $error : Error
__toString()
public
__toString() : string
Return values
stringisErrorResponse()
A message is considered a Response if it has an ID and either a result or an error
public
static isErrorResponse(object $msg) : bool
Parameters
- $msg : object
-
A decoded message body
Return values
boolisResponse()
A message is considered a Response if it has an ID and either a result or an error
public
static isResponse(object $msg) : bool
Parameters
- $msg : object
-
A decoded message body
Return values
boolparse()
Returns the appropriate Message subclass
public
static parse(string $msg) : Message
Parameters
- $msg : string