forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.ts
More file actions
21 lines (16 loc) · 655 Bytes
/
helpers.ts
File metadata and controls
21 lines (16 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { ModuleNotInstalledError } from './errors/moduleNotInstalledError';
export function isNotInstalledError(error: Error): boolean {
const isError = typeof error === 'object' && error !== null;
const errorObj = <any>error;
if (!isError) {
return false;
}
if (error instanceof ModuleNotInstalledError) {
return true;
}
const isModuleNoInstalledError = error.message.indexOf('No module named') >= 0;
return errorObj.code === 'ENOENT' || errorObj.code === 127 || isModuleNoInstalledError;
}