Skip to content

Commit 7f86804

Browse files
Copiloteleanorjboyd
andcommitted
Add error handling for conda environment creation and spawn errors
Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
1 parent 9e30deb commit 7f86804

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/managers/conda/condaEnvManager.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ export class CondaEnvManager implements EnvironmentManager, Disposable {
191191
return result;
192192
} catch (error) {
193193
this.log.error('Failed to create conda environment:', error);
194+
showErrorMessage(
195+
l10n.t('Failed to create conda environment: {0}', error instanceof Error ? error.message : String(error)),
196+
);
194197
return undefined;
195198
}
196199
}

src/managers/conda/condaUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ async function _runConda(
212212
deferred.reject(new CancellationError());
213213
});
214214

215+
proc.on('error', (err) => {
216+
log?.error(`Error spawning conda: ${err}`);
217+
deferred.reject(new Error(`Error spawning conda: ${err.message}`));
218+
});
219+
215220
let stdout = '';
216221
let stderr = '';
217222
proc.stdout?.on('data', (data) => {

0 commit comments

Comments
 (0)