From 9db5c70cdd97c92d8f77980792fe10fd2a63b0ce Mon Sep 17 00:00:00 2001 From: Eishan Lawrence Date: Wed, 19 Feb 2020 00:15:42 -0800 Subject: [PATCH 1/3] Log installation failure to an output channel instead of failing silently --- src/extension_utils/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/extension_utils/utils.ts b/src/extension_utils/utils.ts index ed6f83989..23f5a864a 100644 --- a/src/extension_utils/utils.ts +++ b/src/extension_utils/utils.ts @@ -22,6 +22,8 @@ import { DependencyChecker } from "./dependencyChecker"; const exec = util.promisify(cp.exec); +const errorChannel = vscode.window.createOutputChannel("Error"); + // tslint:disable-next-line: export-name export const getPathToScript = ( context: vscode.ExtensionContext, @@ -369,6 +371,7 @@ export const installPythonDependencies = async ( }); console.error(err); + this.logToOutputChannel(errorChannel, err.toString(), true /* show */) installed = false; } return installed; From 27b1759d127b1c07753359822564cfb6d55d9138 Mon Sep 17 00:00:00 2001 From: Eishan Lawrence Date: Wed, 19 Feb 2020 00:24:44 -0800 Subject: [PATCH 2/3] Added constant for installation error channel name --- src/constants.ts | 4 ++++ src/extension_utils/utils.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index 96f8c2c3f..e45642fc5 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -71,6 +71,10 @@ export const CONSTANTS = { "error.incorrectFileNameForDevicePopup", 'Seems like you have a different file name than what CPX requires, please rename it to "code.py" or "main.py".' ), + INSTALLATION_ERROR: localize( + "error.installationError", + "Installation Error" + ), INVALID_FILE_EXTENSION_DEBUG: localize( "error.invalidFileExtensionDebug", "The file you tried to run isn't a Python file." diff --git a/src/extension_utils/utils.ts b/src/extension_utils/utils.ts index 23f5a864a..599a74d12 100644 --- a/src/extension_utils/utils.ts +++ b/src/extension_utils/utils.ts @@ -22,7 +22,7 @@ import { DependencyChecker } from "./dependencyChecker"; const exec = util.promisify(cp.exec); -const errorChannel = vscode.window.createOutputChannel("Error"); +const errorChannel = vscode.window.createOutputChannel(CONSTANTS.ERROR.INSTALLATION_ERROR); // tslint:disable-next-line: export-name export const getPathToScript = ( From 4154e793079908ea5854ba4b293d9a29bb0b4c9f Mon Sep 17 00:00:00 2001 From: Eishan Lawrence Date: Wed, 19 Feb 2020 00:41:23 -0800 Subject: [PATCH 3/3] Ran npm format --- src/constants.ts | 2 +- src/extension_utils/utils.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index e45642fc5..c37d67f22 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -73,7 +73,7 @@ export const CONSTANTS = { ), INSTALLATION_ERROR: localize( "error.installationError", - "Installation Error" + "Installation Error" ), INVALID_FILE_EXTENSION_DEBUG: localize( "error.invalidFileExtensionDebug", diff --git a/src/extension_utils/utils.ts b/src/extension_utils/utils.ts index 599a74d12..5a97f7ef2 100644 --- a/src/extension_utils/utils.ts +++ b/src/extension_utils/utils.ts @@ -22,7 +22,9 @@ import { DependencyChecker } from "./dependencyChecker"; const exec = util.promisify(cp.exec); -const errorChannel = vscode.window.createOutputChannel(CONSTANTS.ERROR.INSTALLATION_ERROR); +const errorChannel = vscode.window.createOutputChannel( + CONSTANTS.ERROR.INSTALLATION_ERROR +); // tslint:disable-next-line: export-name export const getPathToScript = ( @@ -371,7 +373,7 @@ export const installPythonDependencies = async ( }); console.error(err); - this.logToOutputChannel(errorChannel, err.toString(), true /* show */) + this.logToOutputChannel(errorChannel, err.toString(), true /* show */); installed = false; } return installed;