From 1620b3b374cd30e8886c57178d55f03442061b93 Mon Sep 17 00:00:00 2001 From: Benjin Dubishar Date: Sun, 7 May 2023 13:08:04 -0700 Subject: [PATCH] Fixing deleteDatabaseReference test for vscode-mssql (#23008) --- extensions/sql-database-projects/src/common/constants.ts | 2 +- .../src/controllers/projectController.ts | 4 ++-- extensions/types/vscode-mssql.d.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/sql-database-projects/src/common/constants.ts b/extensions/sql-database-projects/src/common/constants.ts index 36fa430d97..2f9fed76a4 100644 --- a/extensions/sql-database-projects/src/common/constants.ts +++ b/extensions/sql-database-projects/src/common/constants.ts @@ -420,7 +420,7 @@ export function circularProjectReference(project1: string, project2: string) { r export function errorFindingBuildFilesLocation(err: any) { return localize('errorFindingBuildFilesLocation', "Error finding build files location: {0}", utils.getErrorMessage(err)); } export function projBuildFailed(errorMessage: string) { return localize('projBuildFailed', "Build failed. Check output pane for more details. {0}", errorMessage); } export function unexpectedProjectContext(uri: string) { return localize('unexpectedProjectContext', "Unable to establish project context. Command invoked from unexpected location: {0}", uri); } -export function unableToPerformAction(action: string, uri: string) { return localize('unableToPerformAction', "Unable to locate '{0}' target: '{1}'", action, uri); } +export function unableToPerformAction(action: string, uri: string, error?: string) { return localize('unableToPerformAction', "Unable to locate '{0}' target: '{1}'. {2}", action, uri, error); } export function unableToFindObject(path: string, objType: string) { return localize('unableToFindFile', "Unable to find {1} with path '{0}'", path, objType); } export function deployScriptExists(scriptType: string) { return localize('deployScriptExists', "A {0} script already exists. The new script will not be included in build.", scriptType); } export function cantAddCircularProjectReference(project: string) { return localize('cantAddCircularProjectReference', "A reference to project '{0}' cannot be added. Adding this project as a reference would cause a circular dependency", project); } diff --git a/extensions/sql-database-projects/src/controllers/projectController.ts b/extensions/sql-database-projects/src/controllers/projectController.ts index 7663125df7..011b3a1290 100644 --- a/extensions/sql-database-projects/src/controllers/projectController.ts +++ b/extensions/sql-database-projects/src/controllers/projectController.ts @@ -888,12 +888,12 @@ export class ProjectsController { .send(); this.refreshProjectsTree(context); - } catch { + } catch (err) { TelemetryReporter.createErrorEvent2(TelemetryViews.ProjectTree, TelemetryActions.deleteObjectFromProject) .withAdditionalProperties({ objectType: node.constructor.name }) .send(); - void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.deleteAction, node.relativeProjectUri.path)); + void vscode.window.showErrorMessage(constants.unableToPerformAction(constants.deleteAction, node.relativeProjectUri.path, utils.getErrorMessage(err))); } } diff --git a/extensions/types/vscode-mssql.d.ts b/extensions/types/vscode-mssql.d.ts index 9766d1c506..d8e30ff642 100644 --- a/extensions/types/vscode-mssql.d.ts +++ b/extensions/types/vscode-mssql.d.ts @@ -502,9 +502,9 @@ declare module 'vscode-mssql' { /** * Delete a database reference from a project * @param projectUri Absolute path of the project, including .sqlproj - * @param path Path of the script, including .sql, relative to the .sqlproj + * @param name Name of the reference to be deleted. Name of the System DB, path of the sqlproj, or path of the dacpac */ - deleteDatabaseReference(projectUri: string, path: string): Promise; + deleteDatabaseReference(projectUri: string, name: string): Promise; /** * Add a folder to a project