Преглед на файлове

Catch exception instead of masking it

Bond_009 преди 6 години
родител
ревизия
bf4de012da
променени са 1 файла, в които са добавени 10 реда и са изтрити 3 реда
  1. 10 3
      Jellyfin.Server/Program.cs

+ 10 - 3
Jellyfin.Server/Program.cs

@@ -105,9 +105,16 @@ namespace Jellyfin.Server
                 await appHost.RunStartupTasks();
 
                 // TODO: read input for a stop command
-                // Block main thread until shutdown
-                await Task.Delay(-1, _tokenSource.Token)
-                    .ContinueWith(delegate{}); // Don't throw on cancellation
+
+                try
+                {
+                    // Block main thread until shutdown
+                    await Task.Delay(-1, _tokenSource.Token);
+                }
+                catch (TaskCanceledException)
+                {
+                    // Don't throw on cancellation
+                }
 
                 _logger.LogInformation("Disposing app host");
             }