Skip to content

Commit 7b95c86

Browse files
author
Kartik Raj
committed
Handle rejected scenario
1 parent 87d84e6 commit 7b95c86

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/client/pythonEnvironments/base/info/interpreter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type InterpreterInformation = {
2626
* @param python - the path to the Python executable
2727
* @param raw - the information returned by the `interpreterInfo.py` script
2828
*/
29-
export function extractPythonEnvInfo(python: string, raw: PythonEnvInfo): InterpreterInformation {
29+
function extractInterpreterInfo(python: string, raw: PythonEnvInfo): InterpreterInformation {
3030
const rawVersion = `${raw.versionInfo.slice(0, 3).join('.')}-${raw.versionInfo[3]}`;
3131
const version = parseVersion(rawVersion);
3232
version.sysVersion = raw.sysVersion;
@@ -89,5 +89,5 @@ export async function getInterpreterInfo(
8989
if (logger) {
9090
logger.info(`Found interpreter for ${argv}`);
9191
}
92-
return extractPythonEnvInfo(python.pythonExecutable, json);
92+
return extractInterpreterInfo(python.pythonExecutable, json);
9393
}

src/client/pythonEnvironments/info/environmentInfoService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
import { injectable } from 'inversify';
5+
import { traceError } from '../../common/logger';
56
import { createDeferred, Deferred } from '../../common/utils/async';
67
import { createWorkerPool, IWorkerPool, QueuePosition } from '../../common/utils/workerPool';
78
import { getInterpreterInfo, InterpreterInformation } from '../base/info/interpreter';
@@ -66,6 +67,10 @@ export class EnvironmentInfoService implements IEnvironmentInfoService {
6667
this.cache.delete(interpreterPath);
6768
}
6869
return r;
70+
}).catch((ex) => {
71+
traceError('Fetching interpreter information failed with error', ex);
72+
deferred.resolve(undefined);
73+
return undefined;
6974
});
7075
}
7176
}

0 commit comments

Comments
 (0)