mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-29 09:35:38 -05:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user