|
5 | 5 | using System.Net.Http; |
6 | 6 | using System.Threading; |
7 | 7 | using System.Threading.Tasks; |
| 8 | +using GeneralUpdate.Common.Internal; |
8 | 9 | using GeneralUpdate.Common.Shared.Object; |
9 | 10 |
|
10 | 11 | namespace GeneralUpdate.Common.Download |
@@ -41,7 +42,7 @@ public async Task LaunchAsync() |
41 | 42 | } |
42 | 43 | catch (Exception exception) |
43 | 44 | { |
44 | | - Debug.WriteLine(exception.Message); |
| 45 | + GeneralTracer.Error("The LaunchAsync method in the DownloadTask class throws an exception." , exception); |
45 | 46 | _manager.OnMultiDownloadError(this, new MultiDownloadErrorEventArgs(exception, _version)); |
46 | 47 | } |
47 | 48 | } |
@@ -82,7 +83,7 @@ private async Task DownloadFileRangeAsync(string url, string path) |
82 | 83 | catch (Exception exception) |
83 | 84 | { |
84 | 85 | OnDownloadCompleted(false); |
85 | | - Debug.WriteLine(exception.Message); |
| 86 | + GeneralTracer.Error("The DownloadFileRangeAsync method in the DownloadTask class throws an exception." , exception); |
86 | 87 | _manager.OnMultiDownloadError(this, new MultiDownloadErrorEventArgs(exception, _version)); |
87 | 88 | } |
88 | 89 | } |
@@ -124,7 +125,7 @@ private async Task WriteFileAsync(string tempPath, byte[] chunk, long totalBytes |
124 | 125 | catch (Exception exception) |
125 | 126 | { |
126 | 127 | OnDownloadCompleted(false); |
127 | | - Debug.WriteLine(exception); |
| 128 | + GeneralTracer.Error("The WriteFileAsync method in the DownloadTask class throws an exception." , exception); |
128 | 129 | _manager.OnMultiDownloadError(this, new MultiDownloadErrorEventArgs(exception, _version)); |
129 | 130 | } |
130 | 131 | } |
@@ -170,7 +171,7 @@ private void OnDownloadCompleted(bool isComplated) |
170 | 171 | } |
171 | 172 | catch (Exception exception) |
172 | 173 | { |
173 | | - Debug.WriteLine(exception.Message); |
| 174 | + GeneralTracer.Error(exception.Message, exception); |
174 | 175 | _manager.OnMultiDownloadError(this, new MultiDownloadErrorEventArgs(exception, _version)); |
175 | 176 | } |
176 | 177 | } |
@@ -270,12 +271,12 @@ private void DisposeTimer() |
270 | 271 | } |
271 | 272 | catch (ObjectDisposedException exception) |
272 | 273 | { |
273 | | - Debug.WriteLine("Timer has already been disposed: " + exception.Message); |
| 274 | + GeneralTracer.Error("Timer has already been disposed: " + exception.Message); |
274 | 275 | _manager.OnMultiDownloadError(this, new MultiDownloadErrorEventArgs(exception, _version)); |
275 | 276 | } |
276 | 277 | catch (Exception exception) |
277 | 278 | { |
278 | | - Debug.WriteLine("An error occurred while disposing the timer: " + exception.Message); |
| 279 | + GeneralTracer.Error("An error occurred while disposing the timer.", exception); |
279 | 280 | _manager.OnMultiDownloadError(this, new MultiDownloadErrorEventArgs(exception, _version)); |
280 | 281 | } |
281 | 282 | finally |
|
0 commit comments