Skip to content

Commit

Permalink
A TaskCanceledException is a timeout and should always translate to a…
Browse files Browse the repository at this point in the history
… ServerUnavailableException

Resolves Issue #112
  • Loading branch information
lprichar committed Jan 24, 2018
1 parent 0e9ef18 commit f45a16a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions TfsRestServices/TfsRestWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ protected override IList<BuildStatus> GetBuildStatus()
throw new ServerUnavailableException();
}

var taskCancelledException = ex.InnerExceptions.FirstOrDefault(x => x is TaskCanceledException);
if (!ReferenceEquals(null, taskCancelledException))
{
throw taskCancelledException;
}
throw;
}
catch (WebException ex)
Expand All @@ -75,6 +70,8 @@ private static bool IsInvalidCredentials(Exception ex)

private static bool IsServerUnavailable(Exception ex)
{
if (ex is TaskCanceledException)
return true;
if (ex is WebException webException)
return IsServerUnavailable(webException);
if (ex is HttpRequestException httpRequestException)
Expand Down

0 comments on commit f45a16a

Please sign in to comment.