Bug/schemacompare publish and script tasks to send back results (#830)

* Fix Schema compare Publish and Script generation task to return back error messages correctly.

* Elaborating test a bit more to cover tasks

* Validate one task at a time for better clarity

* send back only errors not whole messages since task view doesnt have a good way (other than hover text) to show long messages

* Fixing the negative test cases
This commit is contained in:
Udeesha Gautam
2019-06-27 15:55:26 -07:00
committed by GitHub
parent a4b6c300ac
commit a6450eb180
4 changed files with 59 additions and 8 deletions

View File

@@ -69,6 +69,11 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, ScriptGenerationResult.MasterScript);
}
}
if (!this.ScriptGenerationResult.Success)
{
ErrorMessage = this.ScriptGenerationResult.Message;
throw new Exception(ErrorMessage);
}
}
catch (Exception e)
{

View File

@@ -9,6 +9,7 @@ using Microsoft.SqlTools.Utility;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
@@ -55,6 +56,12 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
try
{
this.PublishResult = this.ComparisonResult.PublishChangesToTarget(this.CancellationToken);
if (!this.PublishResult.Success)
{
// Sending only errors and warnings - because overall message might be too big for task view
ErrorMessage = string.Join(Environment.NewLine, this.PublishResult.Errors.Where(x => x.MessageType == SqlServer.Dac.DacMessageType.Error || x.MessageType == SqlServer.Dac.DacMessageType.Warning));
throw new Exception(ErrorMessage);
}
}
catch (Exception e)
{