azure-storage-common/src/Common/Middlewares/RetryMiddleware.php
protected function onRejected(RequestInterface $request, array $options)
    {
        return function ($reason) use ($request, $options) {
            $isSecondary = Utilities::requestSentToSecondary($request, $options);
            if (!isset($options['retries'])) {
                $options['retries'] = 0;
            }

            if (call_user_func(
                $this->decider,
                $options['retries'],
                $request,
                null,
                $reason,
                $isSecondary
            )) {
                return $this->retry($request, $options);
            }
            return new RejectedPromise($reason);
        };
    }
protected function onRejected(RequestInterface $request, array $options)
    {
        return function ($reason) use ($request, $options) {
            $isSecondary = Utilities::requestSentToSecondary($request, $options);
            if (!isset($options['retries'])) {
                $options['retries'] = 0;
            }

            if (call_user_func(
                $this->decider,
                $options['retries'],
                $request,
                null,
                $reason,
                $isSecondary
            )) {
                return $this->retry($request, $options);
            }
            return new RejectedPromise($reason);
        };
    }
This function will be executed after the request is sent, if
the promise is rejected.

@param  RequestInterface $request the request sent.
@param  array            $options the options that the request sent with.

@return callable