@@ -20,6 +20,7 @@ import {CreateAttachDebugClient, CreateLaunchDebugClient} from "./DebugClients/D
2020import { DjangoApp , LaunchRequestArguments , AttachRequestArguments , DebugFlags , DebugOptions , TelemetryEvent , PythonEvaluationResultFlags } from "./Common/Contracts" ;
2121import * as telemetryContracts from "../common/telemetryContracts" ;
2222import { validatePath } from './Common/Utils' ;
23+ import { isNotInstalledError } from '../common/helpers' ;
2324
2425const CHILD_ENUMEARATION_TIMEOUT = 5000 ;
2526
@@ -191,7 +192,7 @@ export class PythonDebugger extends DebugSession {
191192 this . sendEvent ( new OutputEvent ( error + "\n" , "stderr" ) ) ;
192193 response . success = false ;
193194 let errorMsg = typeof error === "string" ? error : ( ( error . message && error . message . length > 0 ) ? error . message : error + '' ) ;
194- if ( ( < any > error ) . code === 'ENOENT' || ( < any > error ) . code === 127 ) {
195+ if ( isNotInstalledError ( error ) ) {
195196 errorMsg = `Failed to launch the Python Process, please validate the path '${ this . launchArgs . pythonPath } '` ;
196197 }
197198 this . sendErrorResponse ( response , 200 , errorMsg ) ;
@@ -200,7 +201,7 @@ export class PythonDebugger extends DebugSession {
200201 protected unhandledProcessError ( error : any ) {
201202 if ( ! error ) { return ; }
202203 let errorMsg = typeof error === "string" ? error : ( ( error . message && error . message . length > 0 ) ? error . message : "" ) ;
203- if ( ( < any > error ) . code === 'ENOENT' || ( < any > error ) . code === 127 ) {
204+ if ( isNotInstalledError ( error ) ) {
204205 errorMsg = `Failed to launch the Python Process, please validate the path '${ this . launchArgs . pythonPath } '` ;
205206 }
206207 if ( errorMsg . length > 0 ) {
0 commit comments