Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 8c39018

Browse files
committed
Throw the correct exception when aborting downloads
1 parent caf73b8 commit 8c39018

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/GitHub.Api/Tasks/DownloadTask.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,14 @@ protected virtual string RunDownload(bool success)
128128
}
129129
catch (Exception ex)
130130
{
131-
exception = new DownloadException("Error downloading file", ex);
131+
exception = ex;
132132
}
133133
} while (attempts++ < RetryCount);
134134

135135
if (!result)
136136
{
137-
if (exception == null)
138-
exception = new DownloadException("Error downloading file");
139-
throw exception;
137+
Token.ThrowIfCancellationRequested();
138+
throw new DownloadException("Error downloading file", exception);
140139
}
141140

142141
return Destination;

0 commit comments

Comments
 (0)