Notebook Extension: First logging improvements (#13729)

* First logging improvements

* PR feedback for err output
This commit is contained in:
Chris LaFreniere
2020-12-11 11:21:06 -08:00
committed by GitHub
parent 2df67c4f78
commit a5231ec0e5
12 changed files with 28 additions and 20 deletions

View File

@@ -234,7 +234,7 @@ export class JupyterController {
}
public doConfigurePython(jupyterInstaller: JupyterServerInstallation): void {
let pythonWizard = new ConfigurePythonWizard(jupyterInstaller);
let pythonWizard = new ConfigurePythonWizard(jupyterInstaller, this.appContext.outputChannel);
pythonWizard.start().catch((err: any) => {
vscode.window.showErrorMessage(utils.getErrorMessage(err));
});

View File

@@ -435,7 +435,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
let isPythonInstalled = JupyterServerInstallation.isPythonInstalled();
let areRequiredPackagesInstalled = await this.areRequiredPackagesInstalled(kernelDisplayName);
if (!isPythonInstalled || !areRequiredPackagesInstalled) {
let pythonWizard = new ConfigurePythonWizard(this);
let pythonWizard = new ConfigurePythonWizard(this, this.outputChannel);
await pythonWizard.start(kernelDisplayName, true);
return pythonWizard.setupComplete.then(() => {
this._kernelSetupCache.set(kernelDisplayName, true);

View File

@@ -184,7 +184,7 @@ export class JupyterSession implements nb.ISession {
skipSettingEnvironmentVars?: boolean,
private _pythonEnvVarPath?: string) {
this.setEnvironmentVars(skipSettingEnvironmentVars).catch(error => {
console.error(`Unexpected exception setting Jupyter Session variables : ${error}`);
console.error('Unexpected exception setting Jupyter Session variables : ', error);
// We don't want callers to hang forever waiting - it's better to continue on even if we weren't
// able to set environment variables
this._messagesComplete.resolve();
@@ -240,7 +240,7 @@ export class JupyterSession implements nb.ISession {
await this._installation.promptForPythonInstall(kernelInfo.display_name);
} catch (err) {
// Have to swallow the error here to prevent hangs when changing back to the old kernel.
console.error(err.toString());
console.error('Exception encountered prompting for Python install', err);
return this._kernel;
}
}

View File

@@ -279,7 +279,7 @@ export class PerFolderServerInstance implements IServerInstance {
}
private handleConnectionError(error: Error): void {
let action = this.errorHandler.handleError(error);
let action = this.errorHandler.handleError();
if (action === ErrorAction.Shutdown) {
this.notify(this.options.install, localize('jupyterError', "Error sent from Jupyter: {0}", utils.getErrorMessage(error)));
this.stop();
@@ -365,7 +365,7 @@ export class PerFolderServerInstance implements IServerInstance {
class ErrorHandler {
private numErrors: number = 0;
public handleError(error: Error): ErrorAction {
public handleError(): ErrorAction {
this.numErrors++;
return this.numErrors > 3 ? ErrorAction.Shutdown : ErrorAction.Continue;
}