Merge pull request #1468 from PepperDash/fix/ssh-connection-exception

This commit is contained in:
Andrew Welker 2026-08-20 11:52:03 -05:00 committed by GitHub
commit 5cac0bb6c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -287,13 +287,7 @@ namespace PepperDash.Core
} }
catch (SshConnectionException e) catch (SshConnectionException e)
{ {
var ie = e.InnerException; // The details are inside!! var ie = e.InnerException; // The details are inside, when present - remote can close the connection with no inner exception at all
if (ie is SocketException)
{
this.LogError("CONNECTION failure: Cannot reach host");
this.LogVerbose(ie, "Exception details: ");
}
if (ie is System.Net.Sockets.SocketException socketException) if (ie is System.Net.Sockets.SocketException socketException)
{ {
@ -301,15 +295,15 @@ namespace PepperDash.Core
Hostname, Port); Hostname, Port);
this.LogVerbose(socketException, "SocketException details: "); this.LogVerbose(socketException, "SocketException details: ");
} }
if (ie is SshAuthenticationException) else if (ie is SshAuthenticationException)
{ {
this.LogError("Authentication failure for username {userName}", Username); this.LogError("Authentication failure for username {userName}", Username);
this.LogVerbose(ie, "AuthenticationException details: "); this.LogVerbose(ie, "AuthenticationException details: ");
} }
else else
{ {
this.LogError("Error on connect: {error}", ie.Message); this.LogError("Error on connect: {error}", ie?.Message ?? e.Message);
this.LogVerbose(ie, "Exception details: "); this.LogVerbose(ie ?? e, "Exception details: ");
} }
disconnectLogged = true; disconnectLogged = true;