private async Task <ReportingOperationStatus> GetStatusWithRetries() { var retriesLeft = MaxGetStatusRetries; do { try { return(await _statusProvider.GetCurrentStatus(_reportingServiceClient).ConfigureAwait(false)); } catch (FaultException <AdApiFaultDetail> fault) { if (retriesLeft-- <= 0) { throw; } HandlerRateLimitFailure(fault, retriesLeft); } catch (CommunicationException) { if (retriesLeft-- <= 0) { throw; } } catch (TimeoutException) { if (retriesLeft-- <= 0) { throw; } } } while (true); }
/// <summary> /// Gets the status of the reporting operation. /// </summary> /// <returns><see cref="ReportingOperationStatus"/></returns> /// <exception cref="FaultException{TDetail}">Thrown if a fault is returned from the Bing Ads service.</exception> /// <exception cref="OAuthTokenRequestException">Thrown if tokens can't be refreshed due to an error received from the Microsoft Account authorization server.</exception> public async Task <ReportingOperationStatus> GetStatusAsync() { if (FinalStatus != null) { return(FinalStatus); } var currentStatus = await _statusProvider.GetCurrentStatus(_reportingServiceClient).ConfigureAwait(false); if (_statusProvider.IsFinalStatus(currentStatus)) { FinalStatus = currentStatus; } return(currentStatus); }