Fix rest of notebook unhandled promises (#16933)

* Fix rest of notebook unhandled promises

* add rule

* fix some tests
This commit is contained in:
Charles Gagnon
2021-08-30 14:14:48 -07:00
committed by GitHub
parent 26e08fdf9e
commit 76e01fee60
21 changed files with 79 additions and 53 deletions

View File

@@ -156,7 +156,7 @@ export class JupyterController {
+ os.EOL + '.option(\"header\", \"true\")' + os.EOL + '.csv(\'{0}\'))' + os.EOL + 'df.show(10)';
// TODO re-enable insert into document once APIs are finalized.
// editor.document.cells[0].source = [analyzeCommand.replace('{0}', hdfsPath)];
editor.edit(editBuilder => {
await editor.edit(editBuilder => {
editBuilder.replace(0, {
cell_type: 'code',
source: analyzeCommand.replace('{0}', hdfsPath)

View File

@@ -61,7 +61,7 @@ export class JupyterNotebookProvider implements nb.NotebookProvider {
let sessionManager = (manager.sessionManager as JupyterSessionManager);
let session = sessionManager.listRunning().find(e => e.path === notebookUri.fsPath);
if (session) {
manager.sessionManager.shutdown(session.id);
manager.sessionManager.shutdown(session.id).then(undefined, err => console.error('Error shutting down session after notebook closed ', err));
}
if (sessionManager.listRunning().length === 0) {
let notebookConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(constants.notebookConfigKey);

View File

@@ -509,7 +509,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
// If the latest version of ADS-Python is not installed, then prompt the user to upgrade
if (!this._upgradePrompted && isPythonInstalled && !this._usingExistingPython && utils.compareVersions(await this.getInstalledPythonVersion(this._pythonExecutable), constants.pythonVersion) < 0) {
this._upgradePrompted = true;
this.promptUserForPythonUpgrade();
await this.promptUserForPythonUpgrade();
}
let areRequiredPackagesInstalled = await this.areRequiredPackagesInstalled(kernelDisplayName);

View File

@@ -276,7 +276,7 @@ export class PerFolderServerInstance implements IServerInstance {
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();
this.stop().catch(err => console.log('Error stopping Jupyter Server ', err));
}
}
private handleConnectionClosed(): void {