public function Error::__construct in JSON-RPC 2.x
Same name and namespace in other branches
- 8 src/Object/Error.php \Drupal\jsonrpc\Object\Error::__construct()
Error constructor.
Parameters
int $code: The error's type code.
string $message: The error's short description.
mixed $data: (optional) A primitive or structured value that contains additional information about the error. This may be omitted.
\Drupal\Core\Cache\CacheableDependencyInterface $cacheability: (optional) A cacheable dependency.
File
- src/
Object/ Error.php, line 72
Class
- Error
- Error class to help implement JSON RPC's spec for errors.
Namespace
Drupal\jsonrpc\ObjectCode
public function __construct($code, $message, $data = NULL, CacheableDependencyInterface $cacheability = NULL) {
$this
->assertValidError($code, $message);
$this->code = $code;
$this->message = $message;
if (!is_null($data)) {
$this->data = $data;
}
$this
->setCacheability($cacheability ?: new CacheableMetadata());
}