Explicitly erroring out on some failing commands that were not already included (#882)

* Excplitly erroring out on some failing commands that was not happening before

* Ensuring the error message goes through without getting converted to different error
This commit is contained in:
Udeesha Gautam
2019-10-25 15:41:59 -07:00
committed by GitHub
parent 22905c9c13
commit 57b7126ccf
2 changed files with 13 additions and 15 deletions

View File

@@ -485,7 +485,12 @@ namespace Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode
}
catch (BatchParserException ex)
{
if (ex.ErrorCode != ErrorCode.Aborted)
if (ex.ErrorCode == ErrorCode.UnsupportedCommand)
{
result = ScriptExecutionResult.Failure;
RaiseScriptError(string.Format(CultureInfo.CurrentCulture, ex.Message), ScriptMessageType.FatalError);
}
else if (ex.ErrorCode != ErrorCode.Aborted)
{
result = ScriptExecutionResult.Failure;
string info = ex.Text;

View File

@@ -370,12 +370,6 @@ namespace Microsoft.SqlTools.ServiceLayer.BatchParser
LexerTokenType tokenType = LookaheadTokenType;
switch (tokenType)
{
case LexerTokenType.OnError:
RemoveLastWhitespaceToken();
Token onErrorToken = LookaheadToken;
Accept();
ParseOnErrorCommand(onErrorToken);
break;
case LexerTokenType.Eof:
if (tokenBuffer.Count > 0)
{
@@ -387,11 +381,6 @@ namespace Microsoft.SqlTools.ServiceLayer.BatchParser
Accept();
ParseGo();
break;
case LexerTokenType.Include:
RemoveLastWhitespaceToken();
Accept();
ParseInclude();
break;
case LexerTokenType.Comment:
case LexerTokenType.NewLine:
case LexerTokenType.Text:
@@ -405,17 +394,21 @@ namespace Microsoft.SqlTools.ServiceLayer.BatchParser
Accept();
ParseSetvar(setvarToken);
break;
// Supported by SSMS but not by ADS
case LexerTokenType.Include:
case LexerTokenType.OnError:
case LexerTokenType.Connect:
case LexerTokenType.Ed:
case LexerTokenType.ErrorCommand:
case LexerTokenType.Execute:
case LexerTokenType.Exit:
case LexerTokenType.Out:
case LexerTokenType.Quit:
// not supported on SSMS or ADS
case LexerTokenType.Ed:
case LexerTokenType.Help:
case LexerTokenType.List:
case LexerTokenType.ListVar:
case LexerTokenType.Out:
case LexerTokenType.Perftrace:
case LexerTokenType.Quit:
case LexerTokenType.Reset:
case LexerTokenType.Serverlist:
case LexerTokenType.Xml: