More promise cleanup (#8100)

* Some promise cleanup

* Handle more promise issues

* Remove changes that aren't needed anymore

* Use log service

* another one

* Be more explicit

* Some more promises cleaned up

* Handle promises here too

* Strings for errors

* Some more cleanup

* Remove unused imports
This commit is contained in:
Amir Omidi
2019-10-31 14:30:08 -07:00
committed by GitHub
parent 572a83dac7
commit b62c0cf2ab
11 changed files with 165 additions and 189 deletions

View File

@@ -228,7 +228,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
*/
public onSessionCreated(handle: number, session: azdata.ObjectExplorerSession): void {
if (session && session.success) {
this.handleSessionCreated(session);
this.handleSessionCreated(session).catch((e) => this.logService.error(e));
} else {
let errorMessage = session && session.errorMessage ? session.errorMessage : errSessionCreateFailed;
this.logService.error(errorMessage);
@@ -283,7 +283,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
connection.isDisconnecting = true;
this._connectionManagementService.disconnect(connection).then((value) => {
connection.isDisconnecting = false;
});
}).catch((e) => this.logService.error(e));
});
}
}
@@ -346,7 +346,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
return new Promise<azdata.ObjectExplorerExpandInfo>((resolve, reject) => {
let provider = this._providers[providerId];
if (provider) {
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 0, provider: providerId });
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 0, provider: providerId }).catch((e) => this.logService.error(e));
this.expandOrRefreshNode(providerId, session, nodePath).then(result => {
resolve(result);
}, error => {
@@ -484,7 +484,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
public refreshNode(providerId: string, session: azdata.ObjectExplorerSession, nodePath: string): Thenable<azdata.ObjectExplorerExpandInfo> {
let provider = this._providers[providerId];
if (provider) {
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 1, provider: providerId });
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 1, provider: providerId }).catch((e) => this.logService.error(e));
return this.expandOrRefreshNode(providerId, session, nodePath, true);
}
return Promise.resolve(undefined);