Skip to content

Commit 618470b

Browse files
fix(sagemaker): Improve SSH configuration error handling for SageMaker remote connections
1 parent 95216e4 commit 618470b

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

packages/core/src/awsService/sagemaker/commands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ export async function openRemoteConnect(
231231
if (shouldSuppressError(err)) {
232232
return
233233
}
234-
throw err
235234
}
236235
}
237236

packages/core/src/awsService/sagemaker/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export const InstanceTypeNotSelectedMessage = (spaceName: string) => {
4747
export const RemoteAccessRequiredMessage =
4848
'This space requires remote access to be enabled.\nWould you like to restart the space and connect?\nAny unsaved work will be lost.'
4949

50-
export const SshConfigErrorMessage = (sshConfigPath: string) => {
51-
return `Unable to connect. ${sshConfigPath} contains SSH configuration syntax errors. Fix the errors to continue.`
50+
export const SshConfigErrorMessage = () => {
51+
return `Unable to connect. ~/.ssh/config contains invalid SSH configuration. Fix the errors to continue.`
5252
}
5353

5454
export const SmusDeeplinkSessionExpiredError = {

packages/core/src/awsService/sagemaker/model.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,10 @@ export async function prepareDevEnvConnection(
101101
if (err instanceof ToolkitError && err.code === 'SshCheckFailed') {
102102
const sshConfigPath = path.join(os.homedir(), '.ssh', 'config')
103103

104+
// Extracting line number from SSH error message is the best-effort.
105+
// SSH error formats are not standardized and may vary across implementations.
104106
await vscode.window
105-
.showErrorMessage(
106-
SshConfigErrorMessage(sshConfigPath),
107-
{ modal: true, detail: err.message },
108-
'Open SSH Config'
109-
)
107+
.showErrorMessage(SshConfigErrorMessage(), { modal: true, detail: err.message }, 'Open SSH Config')
110108
.then((resp) => {
111109
if (resp === 'Open SSH Config') {
112110
void vscode.window.showTextDocument(vscode.Uri.file(sshConfigPath))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "SageMaker: Enhanced SSH configuration error handling to show user-friendly modal dialogs with line numbers and an \"Open SSH Config\" button for quick fixes."
4+
}

0 commit comments

Comments
 (0)