Skip to content

Commit 8892ce6

Browse files
authored
Fix env error handling (#25049)
Fix #24211
1 parent 09ef3c4 commit 8892ce6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/client/pythonEnvironments/legacyIOC.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { asyncFilter } from '../common/utils/arrayUtils';
2626
import { CondaEnvironmentInfo, isCondaEnvironment } from './common/environmentManagers/conda';
2727
import { isMicrosoftStoreEnvironment } from './common/environmentManagers/microsoftStoreEnv';
2828
import { CondaService } from './common/environmentManagers/condaService';
29-
import { traceVerbose } from '../logging';
29+
import { traceError, traceVerbose } from '../logging';
3030

3131
const convertedKinds = new Map(
3232
Object.entries({
@@ -159,11 +159,16 @@ class ComponentAdapter implements IComponentAdapter {
159159

160160
// We use the same getInterpreters() here as for IInterpreterLocatorService.
161161
public async getInterpreterDetails(pythonPath: string): Promise<PythonEnvironment | undefined> {
162-
const env = await this.api.resolveEnv(pythonPath);
163-
if (!env) {
162+
try {
163+
const env = await this.api.resolveEnv(pythonPath);
164+
if (!env) {
165+
return undefined;
166+
}
167+
return convertEnvInfo(env);
168+
} catch (ex) {
169+
traceError(`Failed to resolve interpreter: ${pythonPath}`, ex);
164170
return undefined;
165171
}
166-
return convertEnvInfo(env);
167172
}
168173

169174
// Implements ICondaService

0 commit comments

Comments
 (0)