private void AddException(SqlScriptEditorControlWrapper sqlScriptEditorControl, ITextSpan textSpan, Exception ex) { if (ex is AggregateException aggregate) { foreach (var error in aggregate.InnerExceptions) { AddException(sqlScriptEditorControl, textSpan, error); } return; } var line = 0; if (ex is NotSupportedQueryFragmentException err) { line = err.Fragment.StartLine; } else if (ex is QueryParseException parse) { line = parse.Error.Line; } if (line != 0) { sqlScriptEditorControl.Results.AddStringToErrors(ex.Message, line, textSpan, true); } else { sqlScriptEditorControl.Results.AddStringToErrors(ex.Message, true); } }
private void ShowError(SqlScriptEditorControlWrapper sqlScriptEditorControl, ITextSpan textSpan, Exception ex) { // Show the results pane sqlScriptEditorControl.StandardPrepareBeforeExecute(); sqlScriptEditorControl.OnExecutionStarted(sqlScriptEditorControl, EventArgs.Empty); sqlScriptEditorControl.ToggleResultsControl(true); sqlScriptEditorControl.Results.StartExecution(); // Add the messages AddException(sqlScriptEditorControl, textSpan, ex); // Show that the query failed sqlScriptEditorControl.Results.OnSqlExecutionCompletedInt(2); }
public QueryExecutionOptions(SqlScriptEditorControlWrapper sqlScriptEditorControl, OptionsPage options) { _sqlScriptEditorControl = sqlScriptEditorControl; _options = options; }