Remove command link from deployment error (#12573)

This commit is contained in:
Charles Gagnon
2020-09-22 14:16:40 -07:00
committed by GitHub
parent 95752a7de5
commit 4f433772af
8 changed files with 28 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ import * as vscode from 'vscode';
import { executeCommand, executeSudoCommand, ExitCodeError, ProcessOutput } from './common/childProcess';
import { HttpClient } from './common/httpClient';
import Logger from './common/logger';
import { getErrorMessage, searchForCmd } from './common/utils';
import { getErrorMessage, NoAzdataError, searchForCmd } from './common/utils';
import { azdataAcceptEulaKey, azdataConfigSection, azdataFound, azdataInstallKey, azdataUpdateKey, debugConfigKey, eulaAccepted, eulaUrl, microsoftPrivacyStatementUrl } from './constants';
import * as loc from './localizedConstants';
import { getPlatformDownloadLink, getPlatformReleaseVersion } from './azdataReleaseInfo';
@@ -195,7 +195,7 @@ export class AzdataTool implements IAzdataTool {
} catch (e) {
// this.path does not exist
await vscode.commands.executeCommand('setContext', azdataFound, false);
throw (loc.noAzdata);
throw new NoAzdataError();
}
throw err; // rethrow the original error
}

View File

@@ -3,8 +3,19 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as azdataExt from 'azdata-ext';
import * as which from 'which';
import * as loc from '../localizedConstants';
export class NoAzdataError extends Error implements azdataExt.ErrorWithLink {
constructor() {
super(loc.noAzdata);
}
public get messageWithLink(): string {
return loc.noAzdataWithLink;
}
}
/**
* Searches for the first instance of the specified executable in the PATH environment variable
* @param exe The executable to search for

View File

@@ -7,6 +7,7 @@ import * as azdataExt from 'azdata-ext';
import * as vscode from 'vscode';
import { checkAndInstallAzdata, checkAndUpdateAzdata, findAzdata, IAzdataTool, promptForEula } from './azdata';
import Logger from './common/logger';
import { NoAzdataError } from './common/utils';
import * as constants from './constants';
import * as loc from './localizedConstants';
@@ -166,7 +167,7 @@ function throwIfNoAzdataOrEulaNotAccepted(): void {
function throwIfNoAzdata() {
if (!localAzdata) {
Logger.log(loc.noAzdata);
throw new Error(loc.noAzdata);
throw new NoAzdataError();
}
}

View File

@@ -46,7 +46,8 @@ export const updateError = (err: any): string => localize('azdata.updateError',
export const platformUnsupported = (platform: string): string => localize('azdata.platformUnsupported', "Platform '{0}' is currently unsupported", platform);
export const unexpectedCommandError = (errMsg: string): string => localize('azdata.unexpectedCommandError', "Unexpected error executing command: {0}", errMsg);
export const unexpectedExitCode = (code: number, err: string): string => localize('azdata.unexpectedExitCode', "Unexpected exit code from command: {1} ({0})", code, err);
export const noAzdata = localize('azdata.NoAzdata', "No Azure Data CLI is available, [install the Azure Data CLI](command:azdata.install) to enable the features that require it.");
export const noAzdata = localize('azdata.noAzdata', "No Azure Data CLI is available, run the command 'Azure Data CLI: Install' to enable the features that require it.");
export const noAzdataWithLink = localize('azdata.noAzdataWithLink', "No Azure Data CLI is available, [install the Azure Data CLI](command:azdata.install) to enable the features that require it.");
export const skipInstall = (config: string): string => localize('azdata.skipInstall', "Skipping installation of Azure Data CLI, since the operation was not user requested and config option: {0}.{1} is {2}", azdataConfigSection, azdataInstallKey, config);
export const skipUpdate = (config: string): string => localize('azdata.skipUpdate', "Skipping update of Azure Data CLI, since the operation was not user requested and config option: {0}.{1} is {2}", azdataConfigSection, azdataUpdateKey, config);
export const noReleaseVersion = (platform: string, releaseInfo: string): string => localize('azdata.noReleaseVersion', "No release version available for platform '{0}'\nRelease info: ${1}", platform, releaseInfo);

View File

@@ -16,6 +16,10 @@ declare module 'azdata-ext' {
name = 'Microsoft.azdata'
}
export interface ErrorWithLink extends Error {
messageWithLink: string;
}
export interface DcEndpointListResult {
description: string, // "Management Proxy"
endpoint: string, // "https://10.91.86.39:30777"