private RetryPolicyVerdict GetRetryPolicyVerdict(uint attempt, IAirHttpResponse response) { if (_parameters.RetryPolicy == null) { return(RetryPolicyVerdict.Return); } var retryPolicy = _parameters.RetryPolicy; if (attempt >= retryPolicy.AttemptsCount) { return(RetryPolicyVerdict.Return); } try { if (retryPolicy.GoodCondition != null && retryPolicy.GoodCondition(response)) { return(RetryPolicyVerdict.Return); } if (retryPolicy.BadCondition != null && retryPolicy.BadCondition(response)) { return(RetryPolicyVerdict.Continue); } if (response.Failed) { return(RetryPolicyVerdict.Continue); } } catch (Exception) { return(RetryPolicyVerdict.Continue); } return(RetryPolicyVerdict.Return); }
public static IAirHttpResponse <TValue> Success <TValue>(this IAirHttpResponse <TValue> airHttpResponse, Action <TValue> callback) { return(airHttpResponse.Success(r => callback(r.Value))); }