Error implements MessageInterface
A response to a request that indicates an error occurred.
Tags
Table of Contents
Interfaces
- MessageInterface
- Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
Constants
- INTERNAL_ERROR = -32603
- INVALID_PARAMS = -32602
- INVALID_REQUEST = -32600
- METHOD_NOT_FOUND = -32601
- PARSE_ERROR = -32700
- RESOURCE_NOT_FOUND = -32002
- SERVER_ERROR = -32000
Properties
Methods
- __construct() : mixed
- forInternalError() : self
- forInvalidParams() : self
- forInvalidRequest() : self
- forMethodNotFound() : self
- forParseError() : self
- forResourceNotFound() : self
- forServerError() : self
- fromArray() : self
- getId() : string|int
- jsonSerialize() : array{jsonrpc: string, id: string|int, error: array{code: int, message: string}, data?: mixed}
Constants
INTERNAL_ERROR
public
mixed
INTERNAL_ERROR
= -32603
INVALID_PARAMS
public
mixed
INVALID_PARAMS
= -32602
INVALID_REQUEST
public
mixed
INVALID_REQUEST
= -32600
METHOD_NOT_FOUND
public
mixed
METHOD_NOT_FOUND
= -32601
PARSE_ERROR
public
mixed
PARSE_ERROR
= -32700
RESOURCE_NOT_FOUND
public
mixed
RESOURCE_NOT_FOUND
= -32002
SERVER_ERROR
public
mixed
SERVER_ERROR
= -32000
Properties
$code read-only
public
int
$code
$data read-only
public
mixed
$data
= null
$id read-only
public
string|int
$id
$message read-only
public
string
$message
Methods
__construct()
public
__construct(string|int $id, int $code, string $message[, mixed|null $data = null ]) : mixed
Parameters
- $id : string|int
- $code : int
-
the error type that occurred
- $message : string
-
a short description of the error
- $data : mixed|null = null
-
additional information about the error
forInternalError()
public
final static forInternalError(string $message[, string|int $id = '' ]) : self
Parameters
- $message : string
- $id : string|int = ''
Return values
selfforInvalidParams()
public
final static forInvalidParams(string $message[, string|int $id = '' ][, mixed $data = null ]) : self
Parameters
- $message : string
- $id : string|int = ''
- $data : mixed = null
Return values
selfforInvalidRequest()
public
final static forInvalidRequest(string $message[, string|int $id = '' ]) : self
Parameters
- $message : string
- $id : string|int = ''
Return values
selfforMethodNotFound()
public
final static forMethodNotFound(string $message[, string|int $id = '' ]) : self
Parameters
- $message : string
- $id : string|int = ''
Return values
selfforParseError()
public
final static forParseError(string $message[, string|int $id = '' ]) : self
Parameters
- $message : string
- $id : string|int = ''
Return values
selfforResourceNotFound()
public
final static forResourceNotFound(string $message[, string|int $id = '' ]) : self
Parameters
- $message : string
- $id : string|int = ''
Return values
selfforServerError()
public
final static forServerError(string $message[, string|int $id = '' ]) : self
Parameters
- $message : string
- $id : string|int = ''
Return values
selffromArray()
public
final static fromArray(ErrorData $data) : self
Parameters
- $data : ErrorData
Return values
selfgetId()
public
getId() : string|int
Return values
string|intjsonSerialize()
public
jsonSerialize() : array{jsonrpc: string, id: string|int, error: array{code: int, message: string}, data?: mixed}