Skip to content

Commit 45366c3

Browse files
committed
connection now only eats webexceptions
1 parent 50fb639 commit 45366c3

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/Nest/Domain/Connection/Connection.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,7 @@ protected virtual ConnectionStatus DoSynchronousRequest(HttpWebRequest request,
190190
catch (WebException webException)
191191
{
192192
return new ConnectionStatus(webException) { Request = data, RequestUrl = request.RequestUri.ToString(), RequestMethod = request.Method };
193-
}
194-
catch
195-
{
196-
throw;
197-
}
198-
193+
}
199194
}
200195

201196
protected virtual Task<ConnectionStatus> DoAsyncRequest(HttpWebRequest request, string data = null)
@@ -286,13 +281,15 @@ public void Iterate(IEnumerable<Task> asyncIterator, TaskCompletionSource<Connec
286281
{
287282
if (completedTask != null && completedTask.IsFaulted)
288283
{
289-
var exception = completedTask.Exception.InnerException;
290-
//cleanly exit from exceptions in stages
291284
//none of the individual steps in _AsyncSteps run in parallel for 1 request
292285
//as this would be impossible we can assume Aggregate Exception.InnerException
293-
294-
tcs.SetResult(new ConnectionStatus(exception));
295-
//tcs.TrySetException();
286+
var exception = completedTask.Exception.InnerException;
287+
288+
//cleanly exit from exceptions in stages if the exception is a webexception
289+
if (exception is WebException)
290+
tcs.SetResult(new ConnectionStatus(exception));
291+
else
292+
tcs.TrySetException(exception);
296293
enumerator.Dispose();
297294
}
298295
else if (enumerator.MoveNext())

0 commit comments

Comments
 (0)