diff --git a/extensions/mssql/config.json b/extensions/mssql/config.json index dfab333ca1..2b73847368 100644 --- a/extensions/mssql/config.json +++ b/extensions/mssql/config.json @@ -1,6 +1,6 @@ { "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", - "version": "4.10.0.4", + "version": "4.10.0.14", "downloadFileNames": { "Windows_86": "win-x86-net7.0.zip", "Windows_64": "win-x64-net7.0.zip", diff --git a/extensions/mssql/src/objectManagement/interfaces.ts b/extensions/mssql/src/objectManagement/interfaces.ts index a49fcc8e16..b2bac6108f 100644 --- a/extensions/mssql/src/objectManagement/interfaces.ts +++ b/extensions/mssql/src/objectManagement/interfaces.ts @@ -544,7 +544,7 @@ export enum AffinityType { } export interface Server extends ObjectManagement.SqlObject { - hardwareGeneration: string; + hardwareGeneration?: string; language: string; memoryInMB: number; operatingSystem: string; @@ -553,14 +553,14 @@ export interface Server extends ObjectManagement.SqlObject { version: string; isClustered: boolean; isHadrEnabled: boolean; - isPolyBaseInstalled: boolean; - isXTPSupported: boolean; + isPolyBaseInstalled?: boolean; + isXTPSupported?: boolean; product: string; - reservedStorageSizeMB: number; + reservedStorageSizeMB?: number; rootDirectory: string; serverCollation: string; - serviceTier: string; - storageSpaceUsageInMB: number; + serviceTier?: string; + storageSpaceUsageInMB?: number; minServerMemory: NumericServerProperty; maxServerMemory: NumericServerProperty; autoProcessorAffinityMaskForAll: boolean; diff --git a/extensions/mssql/src/objectManagement/ui/serverPropertiesDialog.ts b/extensions/mssql/src/objectManagement/ui/serverPropertiesDialog.ts index 5e9bd6010a..0ec6a9be3c 100644 --- a/extensions/mssql/src/objectManagement/ui/serverPropertiesDialog.ts +++ b/extensions/mssql/src/objectManagement/ui/serverPropertiesDialog.ts @@ -10,6 +10,7 @@ import { IObjectManagementService } from 'mssql'; import * as localizedConstants from '../localizedConstants'; import * as constants from '../constants'; import { Server, ServerViewInfo, NumaNode, AffinityType, ServerLoginMode, AuditLevel } from '../interfaces'; +import { isUndefinedOrNull } from '../../types'; const Dialog_Width = '750px'; @@ -157,6 +158,19 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { + ariaLabel: localizedConstants.HardwareGenerationText, + inputType: 'text', + enabled: this.options.isNewObject, + value: this.objectInfo.hardwareGeneration.toString() + }); + const hardwareGenerationContainer = this.createLabelInputContainer(localizedConstants.HardwareGenerationText, this.hardwareGenerationInput); + platformItems.push(hardwareGenerationContainer); + } + this.nameInput = this.createInputBox(async () => { }, { ariaLabel: localizedConstants.NameText, inputType: 'text', @@ -164,17 +178,11 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { - ariaLabel: localizedConstants.HardwareGenerationText, - inputType: 'text', - enabled: this.options.isNewObject, - value: this.objectInfo.hardwareGeneration.toString() - }); - const hardwareGenerationContainer = this.createLabelInputContainer(localizedConstants.HardwareGenerationText, this.hardwareGenerationInput); + platformItems.push(nameContainer); this.languageDropdown = this.createDropdown(localizedConstants.LanguageText, async () => { }, [this.objectInfo.language], this.objectInfo.language, this.options.isNewObject); const languageContainer = this.createLabelInputContainer(localizedConstants.LanguageText, this.languageDropdown); + platformItems.push(languageContainer); this.memoryInput = this.createInputBox(async () => { }, { ariaLabel: localizedConstants.MemoryText, @@ -183,6 +191,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { ariaLabel: localizedConstants.OperatingSystemText, @@ -191,6 +200,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { ariaLabel: localizedConstants.PlatformText, @@ -199,6 +209,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { ariaLabel: localizedConstants.ProcessorsText, @@ -207,7 +218,10 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { ariaLabel: localizedConstants.IsClusteredText, inputType: 'text', @@ -215,6 +229,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { ariaLabel: localizedConstants.IsHadrEnabledText, @@ -223,22 +238,29 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { - ariaLabel: localizedConstants.IsPolyBaseInstalledText, - inputType: 'text', - enabled: this.options.isNewObject, - value: this.objectInfo.isPolyBaseInstalled.toString() - }); - const isPolyBaseInstalledContainer = this.createLabelInputContainer(localizedConstants.IsPolyBaseInstalledText, this.isPolyBaseInstalledInput); + if (!isUndefinedOrNull(this.objectInfo.isPolyBaseInstalled)) { + this.isPolyBaseInstalledInput = this.createInputBox(async () => { }, { + ariaLabel: localizedConstants.IsPolyBaseInstalledText, + inputType: 'text', + enabled: this.options.isNewObject, + value: this.objectInfo.isPolyBaseInstalled.toString() + }); + const isPolyBaseInstalledContainer = this.createLabelInputContainer(localizedConstants.IsPolyBaseInstalledText, this.isPolyBaseInstalledInput); + sqlServerItems.push(isPolyBaseInstalledContainer); + } - this.isXTPSupportedInput = this.createInputBox(async () => { }, { - ariaLabel: localizedConstants.IsXTPSupportedText, - inputType: 'text', - enabled: this.options.isNewObject, - value: this.objectInfo.isXTPSupported.toString() - }); - const isXTPSupportedContainer = this.createLabelInputContainer(localizedConstants.IsXTPSupportedText, this.isXTPSupportedInput); + if (!isUndefinedOrNull(this.objectInfo.isXTPSupported)) { + this.isXTPSupportedInput = this.createInputBox(async () => { }, { + ariaLabel: localizedConstants.IsXTPSupportedText, + inputType: 'text', + enabled: this.options.isNewObject, + value: this.objectInfo.isXTPSupported.toString() + }); + const isXTPSupportedContainer = this.createLabelInputContainer(localizedConstants.IsXTPSupportedText, this.isXTPSupportedInput); + sqlServerItems.push(isXTPSupportedContainer); + } this.productInput = this.createInputBox(async () => { }, { ariaLabel: localizedConstants.ProductText, @@ -247,14 +269,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { - ariaLabel: localizedConstants.ReservedStorageSizeInMBText, - inputType: 'text', - enabled: this.options.isNewObject, - value: localizedConstants.StringValueInMB(this.objectInfo.reservedStorageSizeMB.toString()) - }); - const reservedStorageSizeInMBContainer = this.createLabelInputContainer(localizedConstants.ReservedStorageSizeInMBText, this.reservedStorageSizeInMBInput); + sqlServerItems.push(productContainer); this.rootDirectoryInput = this.createInputBox(async () => { }, { ariaLabel: localizedConstants.RootDirectoryText, @@ -263,6 +278,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { ariaLabel: localizedConstants.ServerCollationText, @@ -271,22 +287,7 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { - ariaLabel: localizedConstants.ServiceTierText, - inputType: 'text', - enabled: this.options.isNewObject, - value: this.objectInfo.serviceTier - }); - const serviceTierContainer = this.createLabelInputContainer(localizedConstants.ServiceTierText, this.serviceTierInput); - - this.storageSpaceUsageInMBInput = this.createInputBox(async () => { }, { - ariaLabel: localizedConstants.StorageSpaceUsageInMBText, - inputType: 'text', - enabled: this.options.isNewObject, - value: localizedConstants.StringValueInMB(this.objectInfo.storageSpaceUsageInMB.toString()) - }); - const storageSpaceUsageInMbContainer = this.createLabelInputContainer(localizedConstants.StorageSpaceUsageInMBText, this.storageSpaceUsageInMBInput); + sqlServerItems.push(serverCollationContainer); this.versionInput = this.createInputBox(async () => { }, { ariaLabel: localizedConstants.VersionText, @@ -295,32 +296,39 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase { }, { + ariaLabel: localizedConstants.ReservedStorageSizeInMBText, + inputType: 'text', + enabled: this.options.isNewObject, + value: localizedConstants.StringValueInMB(this.objectInfo.reservedStorageSizeMB.toString()) + }); + const reservedStorageSizeInMBContainer = this.createLabelInputContainer(localizedConstants.ReservedStorageSizeInMBText, this.reservedStorageSizeInMBInput); + sqlServerItems.push(reservedStorageSizeInMBContainer); + } - let sqlServerItems = [ - isClusteredContainer, - isHadrEnabledContainer, - isPolyBaseInstalledContainer, - isXTPSupportedContainer, - productContainer, - rootDirectoryContainer, - serverCollationContainer, - versionContainer - ]; + if (this.objectInfo.serviceTier) { + this.serviceTierInput = this.createInputBox(async () => { }, { + ariaLabel: localizedConstants.ServiceTierText, + inputType: 'text', + enabled: this.options.isNewObject, + value: this.objectInfo.serviceTier + }); + const serviceTierContainer = this.createLabelInputContainer(localizedConstants.ServiceTierText, this.serviceTierInput); + sqlServerItems.push(serviceTierContainer); + } - if (this.engineEdition === azdata.DatabaseEngineEdition.SqlManagedInstance) { - platformItems.unshift(hardwareGenerationContainer); - sqlServerItems.push(reservedStorageSizeInMBContainer, serviceTierContainer, storageSpaceUsageInMbContainer); - // remove isXTPSupported - sqlServerItems.splice(3, 1); + if (!isUndefinedOrNull(this.objectInfo.storageSpaceUsageInMB)) { + this.storageSpaceUsageInMBInput = this.createInputBox(async () => { }, { + ariaLabel: localizedConstants.StorageSpaceUsageInMBText, + inputType: 'text', + enabled: this.options.isNewObject, + value: localizedConstants.StringValueInMB(this.objectInfo.storageSpaceUsageInMB.toString()) + }); + const storageSpaceUsageInMbContainer = this.createLabelInputContainer(localizedConstants.StorageSpaceUsageInMBText, this.storageSpaceUsageInMBInput); + sqlServerItems.push(storageSpaceUsageInMbContainer); } this.platformSection = this.createGroup('Platform', platformItems, true); diff --git a/extensions/sql-database-projects/src/common/utils.ts b/extensions/sql-database-projects/src/common/utils.ts index cea0c30bd2..5cf6f82eb7 100644 --- a/extensions/sql-database-projects/src/common/utils.ts +++ b/extensions/sql-database-projects/src/common/utils.ts @@ -838,3 +838,9 @@ export async function ensureFileExists(absoluteFilePath: string, contents?: stri } } } + +export function throwIfFailed(result: azdataType.ResultStatus | vscodeMssql.ResultStatus): void { + if (!result.success) { + throw new Error(constants.errorPrefix(result.errorMessage)); + } +} diff --git a/extensions/sql-database-projects/src/controllers/projectController.ts b/extensions/sql-database-projects/src/controllers/projectController.ts index 7541d4ef98..b2d4fa5f26 100644 --- a/extensions/sql-database-projects/src/controllers/projectController.ts +++ b/extensions/sql-database-projects/src/controllers/projectController.ts @@ -183,7 +183,9 @@ export class ProjectsController { throw new Error(constants.invalidTargetPlatform(creationParams.targetPlatform, Array.from(constants.targetPlatformToVersion.keys()))); } - const targetPlatform = creationParams.targetPlatform ? constants.targetPlatformToVersion.get(creationParams.targetPlatform)! : constants.defaultDSP; + let targetPlatform = creationParams.targetPlatform ? constants.targetPlatformToVersion.get(creationParams.targetPlatform)! : constants.defaultDSP; + + targetPlatform = constants.MicrosoftDatatoolsSchemaSqlSql + targetPlatform + constants.databaseSchemaProvider; let newProjFileName = creationParams.newProjName; @@ -197,15 +199,19 @@ export class ProjectsController { throw new Error(constants.projectAlreadyExists(newProjFileName, path.parse(newProjFilePath).dir)); } + let result: azdataType.ResultStatus | mssqlVscode.ResultStatus; + const sqlProjectsService = await utils.getSqlProjectsService(); if (utils.getAzdataApi()) { const projectStyle = creationParams.sdkStyle ? mssql.ProjectType.SdkStyle : mssql.ProjectType.LegacyStyle; - await (sqlProjectsService as mssql.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform); + result = await (sqlProjectsService as mssql.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform); } else { const projectStyle = creationParams.sdkStyle ? mssqlVscode.ProjectType.SdkStyle : mssqlVscode.ProjectType.LegacyStyle; - await (sqlProjectsService as mssqlVscode.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform); + result = await (sqlProjectsService as mssqlVscode.ISqlProjectsService).createProject(newProjFilePath, projectStyle, targetPlatform); } + utils.throwIfFailed(result); + await this.addTemplateFiles(newProjFilePath, creationParams.projectTypeId); return newProjFilePath; diff --git a/extensions/sql-database-projects/src/models/project.ts b/extensions/sql-database-projects/src/models/project.ts index 1a205e87e4..71074fc3f5 100644 --- a/extensions/sql-database-projects/src/models/project.ts +++ b/extensions/sql-database-projects/src/models/project.ts @@ -248,7 +248,7 @@ export class Project implements ISqlProject { } const result = await sqlProjService.getProjectProperties(this.projectFilePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); this._projectGuid = result.projectGuid; @@ -274,7 +274,7 @@ export class Project implements ISqlProject { private async readCrossPlatformCompatibility(): Promise { const result = await this.sqlProjService.getCrossPlatformCompatibility(this.projectFilePath) - this.throwIfFailed(result); + utils.throwIfFailed(result); this._isCrossPlatformCompatible = result.isCrossPlatformCompatible; } @@ -302,7 +302,7 @@ export class Project implements ISqlProject { var result: GetScriptsResult = await this.sqlProjService.getSqlObjectScripts(this.projectFilePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); if (result.scripts?.length > 0) { // empty array from SqlToolsService is deserialized as null for (var script of result.scripts) { @@ -326,7 +326,7 @@ export class Project implements ISqlProject { private async readFolders(): Promise { var result: GetFoldersResult = await this.sqlProjService.getFolders(this.projectFilePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); const folderEntries: FileProjectEntry[] = []; @@ -349,7 +349,7 @@ export class Project implements ISqlProject { private async readPreDeployScripts(warnIfMultiple: boolean = false): Promise { var result: GetScriptsResult = await this.sqlProjService.getPreDeploymentScripts(this.projectFilePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); const preDeploymentScriptEntries: FileProjectEntry[] = []; @@ -368,7 +368,7 @@ export class Project implements ISqlProject { private async readPostDeployScripts(warnIfMultiple: boolean = false): Promise { var result: GetScriptsResult = await this.sqlProjService.getPostDeploymentScripts(this.projectFilePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); const postDeploymentScriptEntries: FileProjectEntry[] = []; @@ -394,7 +394,7 @@ export class Project implements ISqlProject { } var result: GetScriptsResult = await sqlProjService.getNoneItems(this.projectFilePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); const noneItemEntries: FileProjectEntry[] = []; @@ -510,7 +510,7 @@ export class Project implements ISqlProject { } const result = await this.sqlProjService.updateProjectForCrossPlatform(this.projectFilePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readCrossPlatformCompatibility(); } @@ -529,7 +529,7 @@ export class Project implements ISqlProject { } const result = await this.sqlProjService.addFolder(this.projectFilePath, relativeFolderPath); - this.throwIfFailed(result); + utils.throwIfFailed(result); // Note: adding a folder does not mean adding the contents of the folder. // SDK projects may still need to adjust their include/exclude globs, and Legacy projects must still include each file @@ -539,7 +539,7 @@ export class Project implements ISqlProject { public async deleteFolder(relativeFolderPath: string): Promise { const result = await this.sqlProjService.deleteFolder(this.projectFilePath, relativeFolderPath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlObjectScripts(); await this.readPreDeployScripts(); @@ -550,7 +550,7 @@ export class Project implements ISqlProject { public async excludeFolder(relativeFolderPath: string): Promise { const result = await this.sqlProjService.excludeFolder(this.projectFilePath, relativeFolderPath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlObjectScripts(); await this.readPreDeployScripts(); @@ -561,7 +561,7 @@ export class Project implements ISqlProject { public async moveFolder(relativeSourcePath: string, relativeDestinationPath: string): Promise { const result = await this.sqlProjService.moveFolder(this.projectFilePath, relativeSourcePath, relativeDestinationPath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlObjectScripts(); await this.readPreDeployScripts(); @@ -576,7 +576,7 @@ export class Project implements ISqlProject { public async addSqlObjectScript(relativePath: string, reloadAfter: boolean = true): Promise { const result = await this.sqlProjService.addSqlObjectScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); if (reloadAfter) { await this.readSqlObjectScripts(); @@ -595,7 +595,7 @@ export class Project implements ISqlProject { public async deleteSqlObjectScript(relativePath: string): Promise { const result = await this.sqlProjService.deleteSqlObjectScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlObjectScripts(); await this.readFolders(); @@ -603,7 +603,7 @@ export class Project implements ISqlProject { public async excludeSqlObjectScript(relativePath: string): Promise { const result = await this.sqlProjService.excludeSqlObjectScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlObjectScripts(); await this.readFolders(); @@ -619,7 +619,7 @@ export class Project implements ISqlProject { } const result = await this.sqlProjService.addPreDeploymentScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readPreDeployScripts(); await this.readNoneItems(); @@ -628,7 +628,7 @@ export class Project implements ISqlProject { public async deletePreDeploymentScript(relativePath: string): Promise { const result = await this.sqlProjService.deletePreDeploymentScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readPreDeployScripts(); await this.readFolders(); @@ -636,7 +636,7 @@ export class Project implements ISqlProject { public async excludePreDeploymentScript(relativePath: string): Promise { const result = await this.sqlProjService.excludePreDeploymentScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readPreDeployScripts(); await this.readFolders(); @@ -652,7 +652,7 @@ export class Project implements ISqlProject { } const result = await this.sqlProjService.addPostDeploymentScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readPostDeployScripts(); await this.readNoneItems(); @@ -661,7 +661,7 @@ export class Project implements ISqlProject { public async deletePostDeploymentScript(relativePath: string): Promise { const result = await this.sqlProjService.deletePostDeploymentScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readPostDeployScripts(); await this.readFolders(); @@ -669,7 +669,7 @@ export class Project implements ISqlProject { public async excludePostDeploymentScript(relativePath: string): Promise { const result = await this.sqlProjService.excludePostDeploymentScript(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readPostDeployScripts(); await this.readFolders(); @@ -681,7 +681,7 @@ export class Project implements ISqlProject { public async addNoneItem(relativePath: string): Promise { const result = await this.sqlProjService.addNoneItem(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readNoneItems(); await this.readFolders(); @@ -689,7 +689,7 @@ export class Project implements ISqlProject { public async deleteNoneItem(relativePath: string): Promise { const result = await this.sqlProjService.deleteNoneItem(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readNoneItems(); await this.readFolders(); @@ -697,7 +697,7 @@ export class Project implements ISqlProject { public async excludeNoneItem(relativePath: string): Promise { const result = await this.sqlProjService.excludeNoneItem(this.projectFilePath, relativePath); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readNoneItems(); await this.readFolders(); @@ -764,7 +764,7 @@ export class Project implements ISqlProject { await this.readNoneItems(); } - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readFolders(); return this.createFileProjectEntry(normalizedRelativeFilePath, EntryType.File); @@ -788,7 +788,7 @@ export class Project implements ISqlProject { this._databaseSchemaProvider = `${constants.MicrosoftDatatoolsSchemaSqlSql}${compatLevel}${constants.databaseSchemaProvider}`; const result = await this.sqlProjService.setDatabaseSchemaProvider(this.projectFilePath, this._databaseSchemaProvider); - this.throwIfFailed(result); + utils.throwIfFailed(result); } /** @@ -921,7 +921,7 @@ export class Project implements ISqlProject { public async deleteDatabaseReference(name: string): Promise { const result = await this.sqlProjService.deleteDatabaseReference(this.projectFilePath, name); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readDatabaseReferences(); } @@ -936,7 +936,7 @@ export class Project implements ISqlProject { */ public async addSqlCmdVariable(name: string, defaultValue: string): Promise { const result = await this.sqlProjService.addSqlCmdVariable(this.projectFilePath, name, defaultValue); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlCmdVariables(); } @@ -947,13 +947,13 @@ export class Project implements ISqlProject { */ public async updateSqlCmdVariable(name: string, defaultValue: string): Promise { const result = await this.sqlProjService.updateSqlCmdVariable(this.projectFilePath, name, defaultValue); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlCmdVariables(); } public async deleteSqlCmdVariable(variableName: string): Promise { const result = await this.sqlProjService.deleteSqlCmdVariable(this.projectFilePath, variableName); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readSqlCmdVariables(); } @@ -979,7 +979,7 @@ export class Project implements ISqlProject { sources.push(databaseSource); const result = await this.sqlProjService.setDatabaseSource(this.projectFilePath, sources.join(';')); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readProjectProperties(); } @@ -1005,7 +1005,7 @@ export class Project implements ISqlProject { sources.splice(index, 1); const result = await this.sqlProjService.setDatabaseSource(this.projectFilePath, sources.join(';')); - this.throwIfFailed(result); + utils.throwIfFailed(result); await this.readProjectProperties(); } @@ -1029,12 +1029,6 @@ export class Project implements ISqlProject { containsCreateTableStatement); } - private throwIfFailed(result: ResultStatus): void { - if (!result.success) { - throw new Error(constants.errorPrefix(result.errorMessage)); - } - } - /** * Moves a file to a different location * @param node Node being moved diff --git a/extensions/sql-database-projects/src/test/project.test.ts b/extensions/sql-database-projects/src/test/project.test.ts index 6ead88436e..8a891871c9 100644 --- a/extensions/sql-database-projects/src/test/project.test.ts +++ b/extensions/sql-database-projects/src/test/project.test.ts @@ -1016,7 +1016,7 @@ describe('Project: properties', function (): void { throw new Error('Should not have succeeded.'); } catch (e) { (e.message).should.startWith('Error: Invalid value for Database Schema Provider:'); - (e.message).should.endWith('expected to be in the form Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider'); + (e.message).should.endWith('expected to be in the form \'Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider\'.'); } });