Skip to content

Commit

Permalink
refactor ExceptionHelper.cs class
Browse files Browse the repository at this point in the history
  • Loading branch information
bezzad committed Sep 18, 2024
1 parent 4730a2a commit de6461f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Downloader/Extensions/Helpers/ExceptionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ internal static class ExceptionHelper
{
internal static bool IsMomentumError(this Exception error)
{
if (error.HasSource("System.Net.Http",
"System.Net.Sockets",
"System.Net.Security"))
if (error.HasSource("System.Net.Http", "System.Net.Sockets", "System.Net.Security"))
return true;

if (error.HasTypeOf(typeof(WebException), typeof(SocketException)))
Expand Down Expand Up @@ -83,11 +81,11 @@ internal static bool CertificateValidationCallBack(object sender,
// If the error is for certificate expiration then it can be continued
return true;
}
else if (certificate.Subject == certificate.Issuer &&
status.Status == X509ChainStatusFlags.UntrustedRoot)

if (status.Status == X509ChainStatusFlags.UntrustedRoot &&
certificate.Subject == certificate.Issuer)
{
// Self-signed certificates with an untrusted root are valid.
continue;
}
else if (status.Status != X509ChainStatusFlags.NoError)
{
Expand All @@ -109,4 +107,4 @@ internal static bool CertificateValidationCallBack(object sender,
return false;
}
}
}
}

0 comments on commit de6461f

Please sign in to comment.