Fixed: Report certificate validation failures when configuring Plex Media Server connection

Closes #4781
This commit is contained in:
Mark McDowall 2021-12-06 20:15:35 -08:00
parent 0ac0a6223a
commit ec62884649
2 changed files with 19 additions and 5 deletions

View File

@ -195,7 +195,12 @@ namespace NzbDrone.Core.Notifications.Plex.Server
} }
catch (WebException ex) catch (WebException ex)
{ {
throw new PlexException("Unable to connect to Plex Media Server", ex); if (ex.Status == WebExceptionStatus.TrustFailure)
{
throw new PlexException("Unable to connect to Plex Media Server, certificate validation failed.", ex);
}
throw new PlexException($"Unable to connect to Plex Media Server, {ex.Message}", ex);
} }
return response.Content; return response.Content;

View File

@ -8,6 +8,7 @@ using NLog;
using NzbDrone.Common.Cache; using NzbDrone.Common.Cache;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Notifications.Plex.Server namespace NzbDrone.Core.Notifications.Plex.Server
{ {
@ -191,15 +192,23 @@ namespace NzbDrone.Core.Notifications.Plex.Server
return new ValidationFailure("Host", "At least one TV library is required"); return new ValidationFailure("Host", "At least one TV library is required");
} }
} }
catch(PlexAuthenticationException ex) catch (PlexAuthenticationException ex)
{ {
_logger.Error(ex, "Unable to connect to Plex Server"); _logger.Error(ex, "Unable to connect to Plex Media Server");
return new ValidationFailure("AuthToken", "Invalid authentication token"); return new ValidationFailure("AuthToken", "Invalid authentication token");
} }
catch (PlexException ex)
{
return new NzbDroneValidationFailure("Host", ex.Message);
}
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Unable to connect to Plex Server"); _logger.Error(ex, "Unable to connect to Plex Media Server");
return new ValidationFailure("Host", "Unable to connect to Plex Server");
return new NzbDroneValidationFailure("Host", "Unable to connect to Plex Media Server")
{
DetailedDescription = ex.Message
};
} }
return null; return null;