From 325066f7edb52481e93be3b3d90db45645d6924b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 26 Dec 2016 12:38:12 -0500 Subject: update logging --- Emby.Server.Implementations/HttpServer/HttpListenerHost.cs | 11 +++++++++-- Emby.Server.Implementations/HttpServer/IHttpListener.cs | 2 +- .../HttpServer/SocketSharp/WebSocketSharpListener.cs | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'Emby.Server.Implementations/HttpServer') diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 0e1f5a551..83885ee2e 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -228,11 +228,14 @@ namespace Emby.Server.Implementations.HttpServer } } - private void ErrorHandler(Exception ex, IRequest httpReq) + private void ErrorHandler(Exception ex, IRequest httpReq, bool logException = true) { try { - _logger.ErrorException("Error processing request", ex); + if (logException) + { + _logger.ErrorException("Error processing request", ex); + } var httpRes = httpReq.Response; @@ -529,6 +532,10 @@ namespace Emby.Server.Implementations.HttpServer ErrorHandler(new FileNotFoundException(), httpReq); } } + catch (OperationCanceledException ex) + { + ErrorHandler(ex, httpReq, false); + } catch (Exception ex) { ErrorHandler(ex, httpReq); diff --git a/Emby.Server.Implementations/HttpServer/IHttpListener.cs b/Emby.Server.Implementations/HttpServer/IHttpListener.cs index 9f96a8e49..18df5682d 100644 --- a/Emby.Server.Implementations/HttpServer/IHttpListener.cs +++ b/Emby.Server.Implementations/HttpServer/IHttpListener.cs @@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.HttpServer /// Gets or sets the error handler. /// /// The error handler. - Action ErrorHandler { get; set; } + Action ErrorHandler { get; set; } /// /// Gets or sets the request handler. diff --git a/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs b/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs index 4606d0e31..652fc4f83 100644 --- a/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs +++ b/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs @@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp _httpRequestFactory = httpRequestFactory; } - public Action ErrorHandler { get; set; } + public Action ErrorHandler { get; set; } public Func RequestHandler { get; set; } public Action WebSocketConnecting { get; set; } @@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp _logger.ErrorException("Error processing request", ex); httpReq = httpReq ?? GetRequest(context); - ErrorHandler(ex, httpReq); + ErrorHandler(ex, httpReq, true); return Task.FromResult(true); } -- cgit v1.2.3