@@ -42,6 +42,10 @@ function getClientOptions(): ClientOptions {
4242}
4343
4444type FailedToProxyCode = 'SSH.AuthenticationFailed' | 'TUNNEL.AuthenticateSSHKeyFailed' | 'NoRunningInstance' | 'FailedToGetAuthInfo' ;
45+
46+ // IgnoredFailedCodes contains the failreCode that don't need to send error report
47+ const IgnoredFailedCodes : FailedToProxyCode [ ] = [ 'NoRunningInstance' ] ;
48+
4549class FailedToProxyError extends Error {
4650 constructor ( public readonly failureCode : FailedToProxyCode , originError ?: Error ) {
4751 const msg = 'Failed to proxy connection: ' + failureCode ;
@@ -135,12 +139,16 @@ class WebSocketSSHProxy {
135139 pipePromise = session . pipe ( pipeSession ) ;
136140 return { } ;
137141 } ) . catch ( async err => {
142+ let sendErrorReport = true
138143 if ( err instanceof FailedToProxyError ) {
139144 this . flow . failureCode = err . failureCode ;
145+ if ( IgnoredFailedCodes . includes ( err . failureCode ) ) {
146+ sendErrorReport = false
147+ }
140148 }
141149 await Promise . allSettled ( [
142150 this . sendUserStatusFlow ( 'failed' ) ,
143- this . sendErrorReport ( this . flow , err , 'failed to authenticate proxy with username: ' + e . username ?? '' )
151+ sendErrorReport ? this . sendErrorReport ( this . flow , err , 'failed to authenticate proxy with username: ' + e . username ?? '' ) : undefined ,
144152 ] ) ;
145153 this . logService . error ( err , 'failed to authenticate proxy with username: ' + e . username ?? '' ) ;
146154 await session . close ( SshDisconnectReason . byApplication , err . toString ( ) , err instanceof Error ? err : undefined ) ;
0 commit comments