From 272adfcef75b8e06f67c16d56371511a37cb3ea5 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 28 Oct 2017 23:58:16 -0400 Subject: [PATCH] Fixed: Better error message for DNS exceptions on mono. --- .../Http/Dispatchers/ManagedHttpDispatcher.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs index 6024d4395..5492f3882 100644 --- a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs +++ b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; @@ -73,7 +73,19 @@ namespace NzbDrone.Common.Http.Dispatchers if (httpWebResponse == null) { - throw; + // The default messages for WebException on mono are pretty horrible. + if (e.Status == WebExceptionStatus.NameResolutionFailure) + { + throw new WebException($"DNS Name Resolution Failure: '{webRequest.RequestUri.Host}'", e.Status); + } + else if (OsInfo.IsNotWindows) + { + throw new WebException($"{e.Message}: '{webRequest.RequestUri}'", e.Status); + } + else + { + throw; + }; } }