Skip to content

Commit f9b88d6

Browse files
committed
doc: add doc string and improve default message
1 parent 88cfab9 commit f9b88d6

File tree

1 file changed

+12
-2
lines changed
  • packages/core/src/shared/extensions

1 file changed

+12
-2
lines changed

packages/core/src/shared/extensions/ssh.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ export class RemoteSshSettings extends Settings.define('remote.SSH', remoteSshTy
130130
}
131131
}
132132

133+
/**
134+
* Test a SSH connection over SSM.
135+
* @param ProcessClass given process to test the connection within.
136+
* @param hostname
137+
* @param sshPath
138+
* @param user
139+
* @param session SSM session credentials. These cannot be reused, so it may be required to create a seperate session for the test connection.
140+
* @returns
141+
*/
133142
export async function testSshConnection(
134143
ProcessClass: typeof ChildProcess,
135144
hostname: string,
@@ -146,8 +155,9 @@ export async function testSshConnection(
146155
},
147156
})
148157
} catch (error) {
149-
const errorMessage = [process.result()?.stderr ?? ''].join('\n')
150-
throw new SshError(errorMessage, { cause: error as Error })
158+
throw new SshError(process.result()?.stderr ?? 'An unknown error occurred when testing the connection', {
159+
cause: error as Error,
160+
})
151161
}
152162
}
153163

0 commit comments

Comments
 (0)