You are here

public function JsonRpcException::__construct in JSON-RPC 8

Same name and namespace in other branches
  1. 2.x src/Exception/JsonRpcException.php \Drupal\jsonrpc\Exception\JsonRpcException::__construct()

JsonRpcException constructor.

Parameters

\Drupal\jsonrpc\Object\Response $response: The JSON-RPC error response object for the exception.

\Throwable $previous: The previous exception.

File

src/Exception/JsonRpcException.php, line 33

Class

JsonRpcException
Custom exception class for the module.

Namespace

Drupal\jsonrpc\Exception

Code

public function __construct(Response $response, \Throwable $previous = NULL) {
  $this->response = $response;
  $error = $response
    ->getError();
  $this
    ->setCacheability($response);
  parent::__construct($error
    ->getMessage(), $error
    ->getCode(), $previous);
}