From 2787d5c57321e27797cbf49331d8e93a6f993f21 Mon Sep 17 00:00:00 2001 From: Ben Cho Date: Tue, 11 Nov 2025 13:24:36 +0100 Subject: [PATCH] qt-python: Show error popup when `pip install` fails --- qt-python/src/installer.ts | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/qt-python/src/installer.ts b/qt-python/src/installer.ts index b21c94c4..69164ab7 100644 --- a/qt-python/src/installer.ts +++ b/qt-python/src/installer.ts @@ -182,21 +182,24 @@ async function tryInstallPySide( runner.onStdout(logIndented); runner.onStderr(logIndented); - if (source.source === 'oss') { - await runner.run('pip install PySide6', { useVenv: true }); - } else if (source.source === 'local' && source.localPath) { - await runner.run('pip install -r requirements.txt', { - useVenv: true, - cwd: source.localPath - }); - } else { - return; - } + try { + if (source.source === 'oss') { + await runner.run('pip install PySide6', { useVenv: true }); + } else if (source.source === 'local' && source.localPath) { + await runner.run('pip install -r requirements.txt', { + useVenv: true, + cwd: source.localPath + }); + } else { + return; + } - await projectManager.refreshEnv(folder); + const pyside = await env.readPySide6PackageInfo(logIndented); + if (!pyside) { + throw new Error('Cannot read PySide6 package information'); + } - const pyside = await env.readPySide6PackageInfo(logIndented); - if (pyside) { + await projectManager.refreshEnv(folder); void vscode.window.showInformationMessage( texts.install.popup.installed( folder.name, @@ -204,7 +207,7 @@ async function tryInstallPySide( env.venvName ?? '' ) ); - } else { + } catch (e) { void vscode.window.showWarningMessage( texts.install.popup.installFailed(folder.name) + ` (${linkShowLogs})` );