Skip to content

Commit 0862b93

Browse files
authored
Make it more clear when a server connection failed due to a timeout (#1592)
1 parent 752e434 commit 0862b93

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/extension.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,10 @@ export async function checkConnection(
562562
}
563563
if (success) return;
564564
}
565+
if (["ECONNABORTED", "ERR_CANCELED"].includes(error?.code)) {
566+
error = `Request timed out; server took longer than ${serverInfoTimeout} ms to respond.`;
567+
message = `Request timed out after ${serverInfoTimeout} ms`;
568+
}
565569
handleError(
566570
errorMessage ?? error,
567571
`Failed to connect to server '${api.serverId}'. Check your server configuration.`
@@ -843,9 +847,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
843847
continue;
844848
}
845849
}
846-
for await (const workspaceFolder of vscode.workspace.workspaceFolders ?? []) {
847-
await addWsServerRootFolderData(workspaceFolder.uri);
848-
}
850+
await Promise.allSettled(
851+
vscode.workspace.workspaceFolders?.map((wsFolder) => addWsServerRootFolderData(wsFolder.uri)) || []
852+
);
849853

850854
xmlContentProvider = new XmlContentProvider();
851855

@@ -1383,9 +1387,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
13831387
const serverName = notIsfs(uri) ? config("conn", configName).server : configName;
13841388
await resolveConnectionSpec(serverName);
13851389
}
1386-
for await (const workspaceFolder of added) {
1387-
await addWsServerRootFolderData(workspaceFolder.uri);
1388-
}
1390+
await Promise.allSettled(added.map((wsFolder) => addWsServerRootFolderData(wsFolder.uri)));
13891391
}),
13901392
vscode.workspace.onDidChangeConfiguration(async ({ affectsConfiguration }) => {
13911393
if (affectsConfiguration("objectscript.conn") || affectsConfiguration("intersystems.servers")) {

0 commit comments

Comments
 (0)