@@ -42,6 +42,10 @@ function getClientOptions(): ClientOptions {
42
42
}
43
43
44
44
type 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
+
45
49
class FailedToProxyError extends Error {
46
50
constructor ( public readonly failureCode : FailedToProxyCode , originError ?: Error ) {
47
51
const msg = 'Failed to proxy connection: ' + failureCode ;
@@ -135,12 +139,16 @@ class WebSocketSSHProxy {
135
139
pipePromise = session . pipe ( pipeSession ) ;
136
140
return { } ;
137
141
} ) . catch ( async err => {
142
+ let sendErrorReport = true
138
143
if ( err instanceof FailedToProxyError ) {
139
144
this . flow . failureCode = err . failureCode ;
145
+ if ( IgnoredFailedCodes . includes ( err . failureCode ) ) {
146
+ sendErrorReport = false
147
+ }
140
148
}
141
149
await Promise . allSettled ( [
142
150
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 ,
144
152
] ) ;
145
153
this . logService . error ( err , 'failed to authenticate proxy with username: ' + e . username ?? '' ) ;
146
154
await session . close ( SshDisconnectReason . byApplication , err . toString ( ) , err instanceof Error ? err : undefined ) ;
0 commit comments