aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-03-21 21:03:48 +0100
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-03-21 21:04:16 +0100
commit92628c4033e59b18ee80d06d15495b0f3f3fe357 (patch)
treea9698f1ada377f732fde33a6d45ce70018cc2266
parentaa546dd36abb688cb3a5d10e589521ebf79ef610 (diff)
Clean up HTTP listener exception handling
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs20
1 files changed, 8 insertions, 12 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 655130fcf..49179a2da 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -527,22 +527,18 @@ namespace Emby.Server.Implementations.HttpServer
}
else
{
- await ErrorHandler(new FileNotFoundException(), httpReq, false).ConfigureAwait(false);
+ throw new FileNotFoundException();
}
}
- catch (Exception ex) when (ex is SocketException || ex is IOException || ex is OperationCanceledException)
- {
- await ErrorHandler(ex, httpReq, false).ConfigureAwait(false);
- }
- catch (SecurityException ex)
- {
- await ErrorHandler(ex, httpReq, false).ConfigureAwait(false);
- }
catch (Exception ex)
{
- var logException = !string.Equals(ex.GetType().Name, "SocketException", StringComparison.OrdinalIgnoreCase);
-
- await ErrorHandler(ex, httpReq, logException).ConfigureAwait(false);
+ bool ignoreStackTrace =
+ ex is SocketException ||
+ ex is IOException ||
+ ex is OperationCanceledException ||
+ ex is SecurityException ||
+ ex is FileNotFoundException;
+ await ErrorHandler(ex, httpReq, ignoreStackTrace).ConfigureAwait(false);
}
finally
{