Ver código fonte

update http exceptions

Luke Pulverenti 8 anos atrás
pai
commit
e8d1685b7e

+ 11 - 2
Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs

@@ -736,10 +736,10 @@ namespace Emby.Common.Implementations.HttpClientManager
             {
                 if (options.LogErrors)
                 {
-                    _logger.ErrorException("Error getting response from " + options.Url, ex);
+                    _logger.ErrorException("Error " + webException.Status + " getting response from " + options.Url, webException);
                 }
 
-                var exception = new HttpException(ex.Message, ex);
+                var exception = new HttpException(webException.Message, webException);
 
                 var response = webException.Response as HttpWebResponse;
                 if (response != null)
@@ -752,6 +752,15 @@ namespace Emby.Common.Implementations.HttpClientManager
                     }
                 }
 
+                if (!exception.StatusCode.HasValue)
+                {
+                    if (webException.Status == WebExceptionStatus.NameResolutionFailure ||
+                        webException.Status == WebExceptionStatus.ConnectFailure)
+                    {
+                        exception.IsTimedOut = true;
+                    }
+                }
+
                 return exception;
             }