mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 17:23:29 -05:00
Added error handling service for providers (#21627)
* added prototype errorHandlerService * added initial contracts * Added WIP client sent request function * added WIP signature for handleOtherError to resourceProviderService * made some small fixes * removed unnecessary resourceProviderId * added updates to contracts and resourceProvider * moved error codes to azdata proposed * added connection type instead of profile * added WIP handleOtherError code * added fix for send * added WIP change password function in resource provider * added work in progress error handling thread * added errorHandler interface * added result error check * renamed errorHandling namespace to diagnostics * WIP rename of errorhandler * light cleanup * Bump json5 from 2.1.3 to 2.2.3 in /extensions/machine-learning (#21514) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Stops second invocation of createNewSession while expanding OE tree items on disconnected servers (#21437) * Debounces second invocation while expanding OE tree items * Minor clean up * Adjusts debounce time * Adding temp trace comments * Adds missing semicolon * Removes debouncer to stop 2nd newSession calls * Removes temp trace comments * Updates comment Co-authored-by: Alan Ren <alanren@microsoft.com> * Bump json5 from 2.1.3 to 2.2.3 in /extensions/admin-tool-ext-win (#21546) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix resource endpoints to end with slash (#21540) * Bump json5 from 2.1.3 to 2.2.3 in /extensions/azcli (#21543) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump json5 from 2.1.3 to 2.2.3 in /extensions/arc (#21544) Bumps [json5](https://github.com/json5/json5) from 2.1.3 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.1.3...v2.2.3) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * renamed diagnostics service slightly * registered service * added work in progress diagnostics implementation * small changes * added new diagnostics exe * Changes for Diagnostics Service (#21583) Co-authored-by: Cheena Malhotra <cmalhotra@microsoft.com> * WIP provider changes * added changes for errorDiagnosticsService * removed stuff from mssql. * made fix to connectionManagementService * added error catch * added small changes * more small changes made * added small changes to handleOtherError * moved changePassword to CMS * added testErrorDiagnosticsService * Added provider-based handling for change password/generic error handling. (#21662) * WIP rework for error connection change * added connectionProfileDuringError * added working password reset * added comments * consolidated connection profile conversion * added additionalObjects parameter. * removed unnecessary error profile grab * added comments * added changes to parameters and comments * added changes and params * added handleConnectionErrorParam * added more changes * added async * added params and more * added many fixes * added updated documentation * added WIP password change dialog with await * added error handling * added comment * added options as parameters * cleaned up parameters * added async * added check fixes * Added username to title * added server name to dialog * Added dialog changes * Revert "Added dialog changes" This reverts commit c2bdcd16f4a0dffdc643ef9cae1c1a20642ac512. * Revert "added server name to dialog" This reverts commit dbd22e80461b5a068643f0c2d6728adce4010978. * Revert "Added username to title" This reverts commit 6d936b4d5f97f9345f8ec2fdbbcf6b52df18820a. * Revert "added check fixes" This reverts commit f58081a5af3276766e2042b4d671455b18add9a7. * Revert "added async" This reverts commit dd1198e26ec7542ec51add0628f588361d674299. * Revert "cleaned up parameters" This reverts commit 51135c9f9db452104697483779d8df15b6430717. * Revert "added options as parameters" This reverts commit b167804a2410558bbe60042e017ae2c77af7697f. * Revert "added comment" This reverts commit 0ad37326a3e025e88f715e3f2547be6825597a8d. * Revert "added error handling" This reverts commit 69340980d2c84056a2bcf126ea77f4b5ed4cddf3. * Revert "added WIP password change dialog with await" This reverts commit 9e43113e07b10421b39575f6c7dd14287662b90d. * added a fix to check * added fixes * added back in change password changes * added in comment * added suggested changes * removed param colons * Update extensions/mssql/src/errorDiagnostics/errorDiagnosticsProvider.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * fixed conversion and provider dialog * altered comments * Update src/sql/platform/connection/common/utils.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * renamed Id * Update src/sql/platform/connection/common/utils.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * Improvements for Change password dialog + logs added (#21794) * Improvements for Change password dialog + logs added * Include server * fixed tab space * added comment --------- Co-authored-by: Alex Ma <alma1@microsoft.com> * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * added fix to id to extHostErrorDiagnostics --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lewis Sanchez <87730006+lewis-sanchez@users.noreply.github.com> Co-authored-by: Alan Ren <alanren@microsoft.com> Co-authored-by: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Co-authored-by: Cheena Malhotra <cmalhotra@microsoft.com> Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { TestConnectionProvider } from 'sql/platform/connection/test/common/testConnectionProvider';
|
||||
import { TestResourceProvider } from 'sql/workbench/services/resourceProvider/test/common/testResourceProviderService';
|
||||
import { TestErrorDiagnosticsService } from 'sql/workbench/services/connection/test/common/testErrorDiagnosticsService';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -52,6 +53,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
let workspaceConfigurationServiceMock: TypeMoq.Mock<TestConfigurationService>;
|
||||
let resourceProviderStubMock: TypeMoq.Mock<TestResourceProvider>;
|
||||
let accountManagementService: TypeMoq.Mock<TestAccountManagementService>;
|
||||
let errorDiagnosticsService: TestErrorDiagnosticsService;
|
||||
|
||||
let none: void;
|
||||
|
||||
@@ -99,6 +101,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
let resourceProviderStub = new TestResourceProvider();
|
||||
resourceProviderStubMock = TypeMoq.Mock.ofInstance(resourceProviderStub);
|
||||
accountManagementService = TypeMoq.Mock.ofType(TestAccountManagementService);
|
||||
errorDiagnosticsService = new TestErrorDiagnosticsService();
|
||||
let root = new ConnectionProfileGroup(ConnectionProfileGroup.RootGroupName, undefined, ConnectionProfileGroup.RootGroupName, undefined, undefined);
|
||||
root.connections = [ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile)];
|
||||
|
||||
@@ -181,6 +184,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
undefined, // IQuickInputService
|
||||
new TestNotificationService(),
|
||||
resourceProviderStubMock.object,
|
||||
errorDiagnosticsService,
|
||||
undefined, // IAngularEventingService
|
||||
accountManagementService.object,
|
||||
testLogService, // ILogService
|
||||
@@ -1574,7 +1578,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
const testInstantiationService = new TestInstantiationService();
|
||||
testInstantiationService.stub(IStorageService, new TestStorageService());
|
||||
testInstantiationService.stubCreateInstance(ConnectionStore, connectionStoreMock.object);
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, errorDiagnosticsService, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
assert.strictEqual(profile.password, '', 'Profile should not have password initially');
|
||||
assert.strictEqual(profile.options['password'], '', 'Profile options should not have password initially');
|
||||
// Check for invalid profile id
|
||||
@@ -1604,7 +1608,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
testInstantiationService.stub(IStorageService, new TestStorageService());
|
||||
testInstantiationService.stubCreateInstance(ConnectionStore, connectionStoreMock.object);
|
||||
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, errorDiagnosticsService, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
assert.strictEqual(profile.password, '', 'Profile should not have password initially');
|
||||
assert.strictEqual(profile.options['password'], '', 'Profile options should not have password initially');
|
||||
let credentials = await connectionManagementService.getConnectionCredentials(profile.id);
|
||||
@@ -1924,7 +1928,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
createInstanceStub.withArgs(ConnectionStore).returns(connectionStoreMock.object);
|
||||
createInstanceStub.withArgs(ConnectionStatusManager).returns(connectionStatusManagerMock.object);
|
||||
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, errorDiagnosticsService, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
|
||||
// dupe connections have been seeded the numbers below already reflected the de-duped results
|
||||
|
||||
@@ -1957,7 +1961,7 @@ test('isRecent should evaluate whether a profile was recently connected or not',
|
||||
});
|
||||
let profile1 = createConnectionProfile('1');
|
||||
let profile2 = createConnectionProfile('2');
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, new TestErrorDiagnosticsService(), undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
assert(connectionManagementService.isRecent(profile1));
|
||||
assert(!connectionManagementService.isRecent(profile2));
|
||||
});
|
||||
@@ -1975,7 +1979,7 @@ test('clearRecentConnection and ConnectionsList should call connectionStore func
|
||||
testInstantiationService.stub(IStorageService, new TestStorageService());
|
||||
sinon.stub(testInstantiationService, 'createInstance').withArgs(ConnectionStore).returns(connectionStoreMock.object);
|
||||
let profile1 = createConnectionProfile('1');
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
const connectionManagementService = new ConnectionManagementService(undefined, testInstantiationService, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, new TestErrorDiagnosticsService(), undefined, undefined, undefined, undefined, getBasicExtensionService(), undefined, undefined, undefined);
|
||||
connectionManagementService.clearRecentConnection(profile1);
|
||||
assert(called);
|
||||
called = false;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { IErrorDiagnosticsService } from 'sql/workbench/services/diagnostics/common/errorDiagnosticsService';
|
||||
|
||||
export class TestErrorDiagnosticsService implements IErrorDiagnosticsService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
registerDiagnosticsProvider(providerId: string, errorDiagnostics: azdata.diagnostics.ErrorDiagnosticsProvider): void {
|
||||
}
|
||||
|
||||
unregisterDiagnosticsProvider(ProviderId: string): void {
|
||||
}
|
||||
|
||||
tryHandleConnectionError(errorCode: number, errorMessage: string, providerId: string, connection: azdata.IConnectionProfile): Promise<azdata.diagnostics.ConnectionDiagnosticsResult> {
|
||||
return Promise.resolve({ handled: false });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user