diff --git a/extensions/azdata/README.md b/extensions/azdata/README.md index fa5ce12f07..cdb5ee3e29 100644 --- a/extensions/azdata/README.md +++ b/extensions/azdata/README.md @@ -1,10 +1,14 @@ -# Microsoft azdata Extension for Azure Data Studio +# Microsoft Azure Data CLI Extension for Azure Data Studio -Welcome to Microsoft azdata for Azure Data Studio! +Welcome to Microsoft Azure Data CLI Extension for Azure Data Studio! + +**This extension is only applicable to customers in the Azure Arc data services private preview. Other usage is not supported at this time.** ## Overview -This extension adds support for azdata within Azure Data Studio. +This extension adds support for the Azure Data CLI (azdata) within Azure Data Studio. + +See https://docs.microsoft.com/cli/azure/?view=azure-cli-latest for more information on the tool. ## Code of Conduct diff --git a/extensions/azdata/package.nls.json b/extensions/azdata/package.nls.json index f1c8086963..9e71972f5d 100644 --- a/extensions/azdata/package.nls.json +++ b/extensions/azdata/package.nls.json @@ -1,6 +1,6 @@ { - "azdata.displayName": "azdata", - "azdata.description": "Support for Azure Data CLI. See https://docs.microsoft.com/cli/azure/?view=azure-cli-latest for more information.", - "azdata.config.title": "azdata Configuration", + "azdata.displayName": "Azure Data CLI", + "azdata.description": "Support for Azure Data CLI.", + "azdata.config.title": "Azure Data CLI Configuration", "azdata.config.debug": "Log debug info to the output channel for all executed azdata commands" } diff --git a/extensions/azdata/src/azdata.ts b/extensions/azdata/src/azdata.ts index 5ea99b454d..9d23d0c0d9 100644 --- a/extensions/azdata/src/azdata.ts +++ b/extensions/azdata/src/azdata.ts @@ -128,11 +128,18 @@ export class AzdataTool implements IAzdataTool { result: output.result }; } catch (err) { - // Since the output is JSON we need to do some extra parsing here to get the correct stderr out. - // The actual value we get is something like ERROR: { stderr: '...' } so we also need to trim - // off the start that isn't a valid JSON blob + if (err instanceof ExitCodeError) { - err.stderr = JSON.parse(err.stderr.substring(err.stderr.indexOf('{'))).stderr; + try { + // For azdata internal errors the output is JSON and so we need to do some extra parsing here + // to get the correct stderr out. The actual value we get is something like + // ERROR: { stderr: '...' } + // so we also need to trim off the start that isn't a valid JSON blob + err.stderr = JSON.parse(err.stderr.substring(err.stderr.indexOf('{'))).stderr; + } catch (err) { + // no op - it means this was probably some other generic error (such as command not being found) + } + } throw err; } @@ -285,9 +292,8 @@ async function installAzdataLinux(): Promise { /** */ async function findSpecificAzdata(): Promise { - const promise = ((process.platform === 'win32') ? searchForCmd('azdata.cmd') : searchForCmd('azdata')); - const path = `"${await promise}"`; // throws if azdata is not found - const versionOutput = await executeAzdataCommand(path, ['--version']); + const path = await ((process.platform === 'win32') ? searchForCmd('azdata.cmd') : searchForCmd('azdata')); + const versionOutput = await executeAzdataCommand(`"${path}"`, ['--version']); return new AzdataTool(path, parseVersion(versionOutput.stdout)); }