Skip to content

Commit af5dd8b

Browse files
committed
Fix exception not showing user visible error on dl
1 parent 7e964fd commit af5dd8b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/NetSparkle/Downloaders/WebClientFileDownloader.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ private async Task StartFileDownloadAsync(Uri uri, string downloadFilePath)
156156
}
157157
else
158158
{
159-
throw new NetSparkleException(string.Format("Cannot download file at {0}: status code of {1} returned", uri.ToString(), response.StatusCode));
159+
throw new NetSparkleException(string.Format("Cannot download file (status code: {1}). {2}", uri.ToString(), response.StatusCode,
160+
!response.Content.Headers.ContentLength.HasValue ? "No content length header sent." : ""));
160161
}
161162
return;
162163
}
@@ -201,7 +202,7 @@ private async Task StartFileDownloadAsync(Uri uri, string downloadFilePath)
201202
{
202203
LogWriter.PrintMessage("Error: {0}", e.Message);
203204
IsDownloading = false;
204-
DownloadFileCompleted?.Invoke(this, new AsyncCompletedEventArgs(e, true, null));
205+
DownloadFileCompleted?.Invoke(this, new AsyncCompletedEventArgs(e, false, null));
205206
}
206207
}
207208

0 commit comments

Comments
 (0)