You are here

protected function Error::assertValidError in JSON-RPC 8

Same name and namespace in other branches
  1. 2.x src/Object/Error.php \Drupal\jsonrpc\Object\Error::assertValidError()

Asserts that the error is valid.

Parameters

mixed $code: The HTTP code.

mixed $message: The output message.

1 call to Error::assertValidError()
Error::__construct in src/Object/Error.php
Error constructor.

File

src/Object/Error.php, line 120

Class

Error
Error class to help implement JSON RPC's spec for errors.

Namespace

Drupal\jsonrpc\Object

Code

protected function assertValidError($code, $message) {
  assert(is_int($code) && !($code >= -32000 && $code <= -32099), "The {$code} code is reserved for implementation-defined server-errors.");
  assert(is_string($message) && strlen($message) < 256, 'The message SHOULD be limited to a concise single sentence.');
}