in src/controllers/connectionManager.ts [393:436]
private async handleConnectionErrors(fileUri: string, connection: ConnectionInfo, result: ConnectionContracts.ConnectionCompleteParams): Promise<void> {
if (result.errorNumber && result.errorMessage && !Utils.isEmpty(result.errorMessage)) {
// Check if the error is an expired password
if (result.errorNumber === Constants.errorPasswordExpired || result.errorNumber === Constants.errorPasswordNeedsReset) {
// TODO: we should allow the user to change their password here once corefx supports SqlConnection.ChangePassword()
Utils.showErrorMsg(Utils.formatString(LocalizedConstants.msgConnectionErrorPasswordExpired, result.errorNumber, result.errorMessage));
} else if (result.errorNumber !== Constants.errorLoginFailed) {
Utils.showErrorMsg(Utils.formatString(LocalizedConstants.msgConnectionError, result.errorNumber, result.errorMessage));
// check whether it's a firewall rule error
let firewallResult = await this.firewallService.handleFirewallRule(result.errorNumber, result.errorMessage);
if (firewallResult.result && firewallResult.ipAddress) {
this._failedUriToFirewallIpMap.set(fileUri, firewallResult.ipAddress);
}
}
connection.errorNumber = result.errorNumber;
connection.errorMessage = result.errorMessage;
} else {
const platformInfo = await PlatformInformation.getCurrent();
if (!platformInfo.isWindows && result.errorMessage && result.errorMessage.includes('Kerberos')) {
const action = await this.vscodeWrapper.showErrorMessage(
Utils.formatString(LocalizedConstants.msgConnectionError2, result.errorMessage),
LocalizedConstants.macOpenSslHelpButton);
if (action && action === LocalizedConstants.macOpenSslHelpButton) {
await vscode.env.openExternal(vscode.Uri.parse(Constants.integratedAuthHelpLink));
}
} else if (platformInfo.runtimeId === Runtime.OSX_10_11_64 &&
result.messages.indexOf('Unable to load DLL \'System.Security.Cryptography.Native\'') !== -1) {
const action = await this.vscodeWrapper.showErrorMessage(Utils.formatString(LocalizedConstants.msgConnectionError2,
LocalizedConstants.macOpenSslErrorMessage), LocalizedConstants.macOpenSslHelpButton);
if (action && action === LocalizedConstants.macOpenSslHelpButton) {
await vscode.env.openExternal(vscode.Uri.parse(Constants.macOpenSslHelpLink));
}
} else {
Utils.showErrorMsg(Utils.formatString(LocalizedConstants.msgConnectionError2, result.messages));
}
}
this.statusView.connectError(fileUri, connection.credentials, result);
this.vscodeWrapper.logToOutputChannel(
Utils.formatString(
LocalizedConstants.msgConnectionFailed,
connection.credentials.server,
result.errorMessage ? result.errorMessage : result.messages)
);
}