Skip to content

Commit fea044e

Browse files
committed
Update GeneralClientOSS.cs
1 parent 3773f46 commit fea044e

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/c#/GeneralUpdate.ClientCore/GeneralClientOSS.cs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ await Task.Run(() =>
5252
}
5353
catch (Exception ex)
5454
{
55-
Debug.WriteLine(ex.Message);
56-
throw new Exception(ex.Message + "\n" + ex.StackTrace);
55+
var error = ex.Message + "\n" + ex.StackTrace;
56+
Trace.WriteLine(error);
57+
throw new Exception(error);
5758
}
5859
});
5960
}
@@ -78,20 +79,13 @@ private static bool IsUpgrade(string clientVersion, string serverVersion)
7879

7980
private static void DownloadFile(string url, string path)
8081
{
81-
try
82+
if (File.Exists(path))
8283
{
83-
if (File.Exists(path))
84-
{
85-
File.SetAttributes(path, FileAttributes.Normal);
86-
File.Delete(path);
87-
}
88-
89-
using var webClient = new WebClient();
90-
webClient.DownloadFile(new Uri(url), path);
91-
}
92-
catch (Exception e)
93-
{
94-
Debug.WriteLine(e);
84+
File.SetAttributes(path, FileAttributes.Normal);
85+
File.Delete(path);
9586
}
87+
88+
using var webClient = new WebClient();
89+
webClient.DownloadFile(new Uri(url), path);
9690
}
9791
}

0 commit comments

Comments
 (0)