Skip to content

Commit 0d584d0

Browse files
committed
qt-python: Show error popup when pip install fails
1 parent 2df37d4 commit 0d584d0

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

qt-python/src/installer.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,27 +175,31 @@ async function tryInstallPySide(
175175
runner.onStdout(logIndented);
176176
runner.onStderr(logIndented);
177177

178-
if (source.source === 'oss') {
179-
await runner.run('pip install PySide6', { useVenv: true });
180-
} else if (source.source === 'local' && source.localPath) {
181-
await runner.run('pip install -r requirements.txt', {
182-
useVenv: true,
183-
cwd: source.localPath
184-
});
185-
} else {
186-
return;
187-
}
178+
try {
179+
if (source.source === 'oss') {
180+
await runner.run('pip install PySide6', { useVenv: true });
181+
} else if (source.source === 'local' && source.localPath) {
182+
await runner.run('pip install -r requirements.txt', {
183+
useVenv: true,
184+
cwd: source.localPath
185+
});
186+
} else {
187+
return;
188+
}
189+
190+
const pyside6Version = await fetchPySide6Version(env);
191+
if (!pyside6Version) {
192+
throw new Error('Cannot read PySide6 version');
193+
}
188194

189-
const pyside6Version = await fetchPySide6Version(env);
190-
if (pyside6Version) {
191195
void vscode.window.showInformationMessage(
192196
texts.install.popup.installed(
193197
folder.name,
194198
pyside6Version,
195199
env.venvName ?? ''
196200
)
197201
);
198-
} else {
202+
} catch (e) {
199203
void vscode.window.showWarningMessage(
200204
texts.install.popup.installFailed(folder.name) + ` (${linkShowLogs})`
201205
);

0 commit comments

Comments
 (0)