protected function requestExceptionHandler(Throwable $exception) : ?Throwable
    {
        if ($exception instanceof RequestException) {
            if (
                $exception->hasResponse() &&
                $exception->getResponse()->hasError()
            ) {
                return new BadRemoteCallException($exception->getResponse());
            }

            return new ConnectionException(
                $exception->getRequest(),
                $exception->getMessage(),
                $exception->getCode()
            );
        }

        return null;
    }
protected function requestExceptionHandler(Throwable $exception) : ?Throwable
    {
        if ($exception instanceof RequestException) {
            if (
                $exception->hasResponse() &&
                $exception->getResponse()->hasError()
            ) {
                return new BadRemoteCallException($exception->getResponse());
            }

            return new ConnectionException(
                $exception->getRequest(),
                $exception->getMessage(),
                $exception->getCode()
            );
        }

        return null;
    }
protected function requestExceptionHandler ( Throwable $ exception ) : ? Throwable { if ( $ exception instanceof RequestException ) { if ( $ exception -> hasResponse ( ) && $ exception -> getResponse ( ) -> hasError ( ) ) { return new BadRemoteCallException ( $ exception -> getResponse ( ) ) ; } return new ConnectionException ( $ exception -> getRequest ( ) , $ exception -> getMessage ( ) , $ exception -> getCode ( ) ) ; } return null ; }
Handle request exception.

@param \Throwable $exception

@return \Throwable|null
Handle request exception .