public async Task Cleanup(Func <IAmazonS3, Task> action) { try { await _inner.Cleanup(action); } catch (OperationCanceledException exception) { throw new TimeoutException("S3 cleanup operation timed out.", exception); } }
public async Task Cleanup(Func <IAmazonS3, Task> action) { try { await _inner.Cleanup(action); } catch (AmazonServiceException exception) when(exception.InnerException is WebException webException && webException.Status == WebExceptionStatus.RequestCanceled) { throw new OperationCanceledException("Amazon service exception treated as cleanup cancellation.", exception); } catch (AmazonS3Exception exception) when(exception.StatusCode == HttpStatusCode.ServiceUnavailable) { throw new OperationCanceledException("S3 \"service unavailable\" exception treated as cleanup cancellation.", exception); } }
public Task Cleanup(Func <IAmazonS3, Task> action) => _inner.Cleanup(action);