Migrate cert validation error handling to mssql extension (#21829)

This commit is contained in:
Cheena Malhotra
2023-02-07 09:21:35 -08:00
committed by GitHub
parent e1b35d266a
commit 66410edf02
29 changed files with 352 additions and 92 deletions

View File

@@ -68,7 +68,7 @@ export interface IConnectionResult {
connected: boolean;
errorMessage: string;
errorCode: number;
callStack: string;
messageDetails: string;
errorHandled?: boolean;
connectionProfile?: IConnectionProfile;
}

View File

@@ -172,7 +172,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
return new Promise<IConnectionResult>((resolve, reject) => {
resolve({ connected: true, errorMessage: undefined!, errorCode: undefined!, callStack: undefined! });
resolve({ connected: true, errorMessage: undefined!, errorCode: undefined!, messageDetails: undefined! });
});
}
@@ -334,4 +334,8 @@ export class TestConnectionManagementService implements IConnectionManagementSer
openChangePasswordDialog(profile: IConnectionProfile): Promise<string | undefined> {
return undefined;
}
openCustomErrorDialog(options: azdata.window.IErrorDialogOptions): Promise<string | undefined> {
return undefined;
}
}

View File

@@ -6,6 +6,7 @@
import Severity from 'vs/base/common/severity';
import { IAction } from 'vs/base/common/actions';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { TelemetryView } from 'sql/platform/telemetry/common/telemetryKeys';
export const IErrorMessageService = createDecorator<IErrorMessageService>('errorMessageService');
export interface IErrorMessageService {
@@ -16,9 +17,10 @@ export interface IErrorMessageService {
* @param headerTitle Title to show on Error modal dialog
* @param message Message containng error message
* @param messageDetails Message details containing stacktrace along with error message
* @param telemetryView Telemetry View to be used for dispatching telemetry events.
* @param actions Custom actions to display on the error message dialog
* @param instructionText Spcial instructions to display to user when displaying error message
* @param instructionText Special instructions to display to user when displaying error message
* @param readMoreLink External link to read more about the instructions.
*/
showDialog(severity: Severity, headerTitle: string, message: string, messageDetails?: string, actions?: IAction[], instructionText?: string, readMoreLink?: string): void;
showDialog(severity: Severity, headerTitle: string, message: string, messageDetails?: string, telemetryView?: TelemetryView, actions?: IAction[], instructionText?: string, readMoreLink?: string): void;
}

View File

@@ -5,9 +5,14 @@
import Severity from 'vs/base/common/severity';
import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMessageService';
import { IErrorDialogOptions } from 'sql/workbench/api/common/sqlExtHostTypes';
import { TelemetryView } from 'sql/platform/telemetry/common/telemetryKeys';
export class TestErrorMessageService implements IErrorMessageService {
_serviceBrand: undefined;
showDialog(severity: Severity, headerTitle: string, message: string): void {
}
showDialogAsync(options: IErrorDialogOptions, telemetryView: TelemetryView): Promise<string | undefined> {
return Promise.resolve(undefined);
}
}

View File

@@ -38,11 +38,13 @@ export const enum TelemetryView {
AgentJobSteps = 'AgentJobSteps',
AgentNotebookHistory = 'AgentNotebookHistory',
AgentNotebooks = 'AgentNotebooks',
ConnectionDialog = 'ConnectionDialog',
ConnectionErrorDialog = 'ConnectionErrorDialog',
ErrorMessageDialog = 'ErrorMessageDialog',
ExecutionPlan = 'ExecutionPlan',
ExtensionHost = 'ExtensionHost',
ExtensionRecommendationDialog = 'ExtensionRecommendationDialog',
Notebook = 'Notebook',
NotifyEncryptionDialog = 'NotifyEncryptionDialog',
ResultsPanel = 'ResultsPanel',
Shell = 'Shell',
SqlAssessment = 'SqlAssessment',
@@ -75,7 +77,6 @@ export const enum TelemetryAction {
DeleteAgentProxy = 'DeleteAgentProxy',
DeleteConnection = 'DeleteConnection',
DeleteServerGroup = 'DeleteServerGroup',
EnableTrustServerCertificate = 'EnableTrustServerCertificate',
FindNode = 'FindNode',
FirewallRuleRequested = 'FirewallRuleCreated',
GenerateScript = 'GenerateScript',