You are here

protected function Server::getErrorHandler in GraphQL 8.4

Returns the error handler.

@todo Handle this through configurable plugins on the server.

Allows to replace the default error handler with a custom one. For example when there is a need to handle specific errors differently.

Return value

mixed|callable The error handler.

See also

\GraphQL\Executor\ExecutionResult::toArray

File

src/Entity/Server.php, line 368

Class

Server
The main GraphQL configuration and request entry point.

Namespace

Drupal\graphql\Entity

Code

protected function getErrorHandler() {
  return function (array $errors, callable $formatter) {
    return array_map($formatter, $errors);
  };
}