fix: update some exception messages to not print exception

Some exceptions are handled and don't need all of the details printed.
This commit is contained in:
Andrew Welker
2025-03-06 12:03:31 -06:00
parent ab61b2673a
commit 8ace195a98

View File

@@ -251,7 +251,7 @@ namespace PepperDash.Core
try try
{ {
Client.Connect(); Client.Connect();
TheStream = Client.CreateShellStream("PDTShell", 100, 80, 100, 200, 65534); TheStream = Client.CreateShellStream("PDTShell", 0, 0, 0, 0, 65534);
if (TheStream.DataAvailable) if (TheStream.DataAvailable)
{ {
// empty the buffer if there is data // empty the buffer if there is data
@@ -269,18 +269,17 @@ namespace PepperDash.Core
if (ie is SocketException) if (ie is SocketException)
{ {
this.LogException(ie, "CONNECTION failure: Cannot reach host, ({1})", Key, ie.Message); this.LogException(ie, "CONNECTION failure: Cannot reach host");
} }
if (ie is System.Net.Sockets.SocketException socketException) if (ie is System.Net.Sockets.SocketException socketException)
{ {
this.LogException(ie, "'{0}' Connection failure: Cannot reach host '{1}' on port {2}, ({3})", this.LogException(ie, "Connection failure: Cannot reach {host} on {port}",
Key, Hostname, Port, ie.GetType()); Hostname, Port);
} }
if (ie is SshAuthenticationException) if (ie is SshAuthenticationException)
{ {
this.LogException(ie, "Authentication failure for username '{0}', ({1})", this, this.LogException(ie, "Authentication failure for username {userName}", Username);
Username, ie.Message);
} }
else else
this.LogException(ie, "Error on connect"); this.LogException(ie, "Error on connect");
@@ -289,7 +288,7 @@ namespace PepperDash.Core
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED); KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
if (AutoReconnect) if (AutoReconnect)
{ {
this.LogDebug("Checking autoreconnect: {0}, {1}ms", AutoReconnect, AutoReconnectIntervalMs); this.LogDebug("Checking autoreconnect: {autoReconnect}, {autoReconnectInterval}ms", AutoReconnect, AutoReconnectIntervalMs);
ReconnectTimer.Reset(AutoReconnectIntervalMs); ReconnectTimer.Reset(AutoReconnectIntervalMs);
} }
} }
@@ -499,14 +498,14 @@ namespace PepperDash.Core
} }
catch (ObjectDisposedException ex) catch (ObjectDisposedException ex)
{ {
this.LogException(ex, "ObjectDisposedException sending {message}", text); this.LogError("ObjectDisposedException sending '{message}'. Restarting connection...", text.Trim());
KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED); KillClient(SocketStatus.SOCKET_STATUS_CONNECT_FAILED);
ReconnectTimer.Reset(); ReconnectTimer.Reset();
} }
catch (Exception ex) catch (Exception ex)
{ {
this.LogException(ex, "Exception sending text: {message}", text); this.LogException(ex, "Exception sending text: '{message}'", text);
} }
} }