Index: Src/GoogleApis/Apis/Requests/ClientServiceRequest.cs
===================================================================
--- a/Src/GoogleApis/Apis/Requests/ClientServiceRequest.cs
+++ b/Src/GoogleApis/Apis/Requests/ClientServiceRequest.cs
@@ -90,10 +90,14 @@
return ParseResponse(response).Result;
}
}
- catch (AggregateException ex)
+ catch (AggregateException aex)
{
// if an exception was thrown during the tasks, unwrap and throw it
- throw ex.InnerException;
+ throw aex.InnerException;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
}
}
@@ -106,10 +110,14 @@
var response = ExecuteUnparsed(CancellationToken.None).Result;
return response.Content.ReadAsStreamAsync().Result;
}
- catch (AggregateException ex)
+ catch (AggregateException aex)
{
// if an exception was thrown during the tasks, unwrap and throw it
- throw ex.InnerException;
+ throw aex.InnerException;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
}
}
@@ -155,6 +163,9 @@
/// Async executes the request without parsing the result.
private Task ExecuteAsyncUnparsed(CancellationToken cancellationToken)
{
+ // TODO(peleyal): remove the creation of a new Task (it's not necessary).
+ // It should also be removed from ResumableMediaUpload and MediaDownloader!
+
// create a new task completion source and return its task. In additional task we actually send the request
// using ExecuteUnparsed and setting the result or the exception on the completion source
TaskCompletionSource tcs = new TaskCompletionSource();