From d6abcb892dd37ab504ab563ea134bd90e46b656d Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 17 Mar 2022 19:43:02 -0700 Subject: [PATCH] handle validation error (#18766) --- src/sql/azdata.proposed.d.ts | 8 ++++++++ .../tableDesigner/browser/tableDesignerComponentInput.ts | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 29dd5f175c..b3c2f1abbd 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -1089,6 +1089,10 @@ declare module 'azdata' { * Issues of current state. */ issues?: { severity: DesignerIssueSeverity, description: string, propertyPath?: DesignerEditPath }[]; + /** + * The input validation error. + */ + inputValidationError?: string; } /** @@ -1118,6 +1122,10 @@ declare module 'azdata' { * Format (mimeType) of the report */ mimeType: string; + /** + * The table schema validation error. + */ + schemaValidationError?: string; } } diff --git a/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts b/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts index 7396ee489a..0524361b43 100644 --- a/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts +++ b/src/sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput.ts @@ -89,6 +89,9 @@ export class TableDesignerComponentInput implements DesignerComponentInput { this.updateState(this.valid, this.dirty, 'processEdit'); this._provider.processTableEdit(this.tableInfo, edit).then( result => { + if (result.inputValidationError) { + this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.inputValidationError', "The input validation failed with error: {0}", result.inputValidationError)); + } this._viewModel = result.viewModel; if (result.view) { this.setDesignerView(result.view); @@ -189,6 +192,10 @@ export class TableDesignerComponentInput implements DesignerComponentInput { this.updateState(this.valid, this.dirty); return; } + if (previewReportResult.schemaValidationError) { + this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.TableSchemaValidationError', "Table schema validation failed with error: {0}", previewReportResult.schemaValidationError)); + return; + } const dialog = this._instantiationService.createInstance(TableDesignerPublishDialog); const result = await dialog.open(previewReportResult.report, previewReportResult.mimeType); if (result === TableDesignerPublishDialogResult.GenerateScript) {