Skip to content

Commit

Permalink
Fixes from TPIs (#21896)
Browse files Browse the repository at this point in the history
Closes #21884
Closes #21889
  • Loading branch information
karthiknadig authored Aug 30, 2023
1 parent f255e02 commit 941fcfa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,9 @@ export namespace CreateEnv {
export const recreateDescription = l10n.t('Delete existing ".venv" environment and create a new one');
export const useExisting = l10n.t('Use Existing');
export const useExistingDescription = l10n.t('Use existing ".venv" environment with no changes to it');
export const existingVenvQuickPickPlaceholder = l10n.t('Use or Recreate existing environment?');
export const existingVenvQuickPickPlaceholder = l10n.t(
'Choose an option to handle the existing ".venv" environment',
);
export const deletingEnvironmentProgress = l10n.t('Deleting existing ".venv" environment...');
export const errorDeletingEnvironment = l10n.t('Error while deleting existing ".venv" environment.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ async function createCondaEnv(
dispose();
if (proc?.exitCode !== 0) {
traceError('Error while running venv creation script: ', progressAndTelemetry.getLastError());
deferred.reject(progressAndTelemetry.getLastError());
deferred.reject(
progressAndTelemetry.getLastError() || `Conda env creation failed with exitCode: ${proc?.exitCode}`,
);
} else {
deferred.resolve(condaEnvPath);
}
Expand Down Expand Up @@ -249,7 +251,7 @@ async function createEnvironment(options?: CreateEnvironmentOptions): Promise<Cr
} catch (ex) {
traceError(ex);
showErrorMessageWithLogs(CreateEnv.Conda.errorCreatingEnvironment);
throw ex;
return { error: ex as Error };
}
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ async function createVenv(
dispose();
if (proc?.exitCode !== 0) {
traceError('Error while running venv creation script: ', progressAndTelemetry.getLastError());
deferred.reject(progressAndTelemetry.getLastError());
deferred.reject(
progressAndTelemetry.getLastError() ||
`Failed to create virtual environment with exitCode: ${proc?.exitCode}`,
);
} else {
deferred.resolve(venvPath);
}
Expand Down Expand Up @@ -327,7 +330,7 @@ export class VenvCreationProvider implements CreateEnvironmentProvider {
} catch (ex) {
traceError(ex);
showErrorMessageWithLogs(CreateEnv.Venv.errorCreatingEnvironment);
throw ex;
return { error: ex as Error };
}
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ suite('Conda Creation provider tests', () => {
assert.isDefined(_error);
_error!('bad arguments');
_complete!();
await assert.isRejected(promise);
const result = await promise;
assert.ok(result?.error);
assert.isTrue(showErrorMessageWithLogsStub.calledOnce);
});

Expand Down Expand Up @@ -241,7 +242,8 @@ suite('Conda Creation provider tests', () => {

_next!({ out: `${CONDA_ENV_CREATED_MARKER}new_environment`, source: 'stdout' });
_complete!();
await assert.isRejected(promise);
const result = await promise;
assert.ok(result?.error);
assert.isTrue(showErrorMessageWithLogsStub.calledOnce);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ suite('venv Creation provider tests', () => {
assert.isDefined(_error);
_error!('bad arguments');
_complete!();
await assert.isRejected(promise);
const result = await promise;
assert.ok(result?.error);
assert.isTrue(showErrorMessageWithLogsStub.calledOnce);
assert.isTrue(deleteEnvironmentStub.notCalled);
});
Expand Down Expand Up @@ -283,7 +284,8 @@ suite('venv Creation provider tests', () => {

_next!({ out: `${VENV_CREATED_MARKER}new_environment`, source: 'stdout' });
_complete!();
await assert.isRejected(promise);
const result = await promise;
assert.ok(result?.error);
interpreterQuickPick.verifyAll();
progressMock.verifyAll();
assert.isTrue(showErrorMessageWithLogsStub.calledOnce);
Expand Down

0 comments on commit 941fcfa

Please sign in to comment.