SignatureBeef / Open-Terraria-API

Open Terraria API - Mac, Linux & Windows
GNU General Public License v3.0
96 stars 38 forks source link

ZipDownload doesn't unwrap exceptions properly #95

Open Arthri opened 1 year ago

Arthri commented 1 year ago

https://github.com/SignatureBeef/Open-Terraria-API/blob/49b9b9ca79e305b65e00712a15e21a5e6a71d281/OTAPI.Patcher/Common.cs#L73

The above line causes download errors to be swallowed and displayed as "A task was canceled."

Unhandled exception. System.AggregateException: One or more errors occurred. (A task was canceled.)
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at OTAPI.Patcher.Common.DownloadZip(String url) in \Open-Terraria-API\OTAPI.Patcher\Common.cs:line 73
   at OTAPI.Patcher.Targets.PCServerTarget.DownloadServer() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 43
   at OTAPI.Patcher.Targets.PCServerTarget.Patch() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 88
   at OTAPI.Patcher.Program.Main(String[] args) in \Open-Terraria-API\OTAPI.Patcher\Program.cs:line 28
--- End of stack trace from previous location ---

   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at OTAPI.Patcher.Common.DownloadZip(String url) in \Open-Terraria-API\OTAPI.Patcher\Common.cs:line 73
   at OTAPI.Patcher.Targets.PCServerTarget.DownloadServer() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 43
   at OTAPI.Patcher.Targets.PCServerTarget.Patch() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 88
   at OTAPI.Patcher.Program.Main(String[] args) in \Open-Terraria-API\OTAPI.Patcher\Program.cs:line 28

fwiw, my error was a network issue causing timeout