private function sendErrorResponse(ClientException $exception): \Generator
    {
        $message = $exception->getMessage();
        $status = $exception->getCode() ?: Status::BAD_REQUEST;

        /** @var \Amp\Http\Server\Response $response */
        $response = yield $this->errorHandler->handleError($status, $message);

        $response->setHeader("connection", "close");

        yield from $this->send($response);
    }
private function sendErrorResponse(ClientException $exception): \Generator
    {
        $message = $exception->getMessage();
        $status = $exception->getCode() ?: Status::BAD_REQUEST;

        /** @var \Amp\Http\Server\Response $response */
        $response = yield $this->errorHandler->handleError($status, $message);

        $response->setHeader("connection", "close");

        yield from $this->send($response);
    }
private function sendErrorResponse ( ClientException $ exception ) : \ Generator { $ message = $ exception -> getMessage ( ) ; $ status = $ exception -> getCode ( ) ? : Status :: BAD_REQUEST ; /** @var \Amp\Http\Server\Response $response */ $ response = yield $ this -> errorHandler -> handleError ( $ status , $ message ) ; $ response -> setHeader ( "connection" , "close" ) ; yield from $ this -> send ( $ response ) ; }
Creates an error response from the error handler and sends that response to the client.

@param \Amp\Http\Server\ClientException $exception

@return \Generator
Creates an error response from the error handler and sends that response to the client .