From e8220919073c965d2e0eefb0359c132b61e1eca9 Mon Sep 17 00:00:00 2001 From: Yurong He <43652751+YurongHe@users.noreply.github.com> Date: Tue, 23 Apr 2019 19:03:49 -0700 Subject: [PATCH] Only when the connection is connected, then do disconnect. (#5170) --- .../workbench/services/notebook/sql/sqlSessionManager.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/services/notebook/sql/sqlSessionManager.ts b/src/sql/workbench/services/notebook/sql/sqlSessionManager.ts index c6fa3fa442..cce7b4b5b1 100644 --- a/src/sql/workbench/services/notebook/sql/sqlSessionManager.ts +++ b/src/sql/workbench/services/notebook/sql/sqlSessionManager.ts @@ -329,7 +329,13 @@ class SqlKernel extends Disposable implements nb.IKernel { public async disconnect(): Promise { if (this._path) { - await this._connectionManagementService.disconnect(this._path); + if (this._connectionManagementService.isConnected(this._path)) { + try { + await this._connectionManagementService.disconnect(this._path); + } catch (err) { + console.log(err); + } + } } return; }