浏览代码

HUE-1773 [beeswax] JS error when there's an error without a particular line/character specified

Fixed bug
Enrico Berti 12 年之前
父节点
当前提交
844a6c8
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      apps/beeswax/src/beeswax/templates/execute.mako

+ 4 - 2
apps/beeswax/src/beeswax/templates/execute.mako

@@ -923,8 +923,10 @@ ${layout.menubar(section='query')}
       if ($(".queryErrorMessage").length > 0) {
       if ($(".queryErrorMessage").length > 0) {
         var err = $(".queryErrorMessage").text().toLowerCase();
         var err = $(".queryErrorMessage").text().toLowerCase();
         var firstPos = err.indexOf("line");
         var firstPos = err.indexOf("line");
-        selectedLine = $.trim(err.substring(err.indexOf(" ", firstPos), err.indexOf(":", firstPos))) * 1;
-        errorWidget = codeMirror.addLineWidget(selectedLine - 1, $("<div>").addClass("editorError").html("<i class='fa fa-exclamation-circle'></i> " + err)[0], {coverGutter: true, noHScroll: true})
+        if (firstPos > -1) {
+          selectedLine = $.trim(err.substring(err.indexOf(" ", firstPos), err.indexOf(":", firstPos))) * 1;
+          errorWidget = codeMirror.addLineWidget(selectedLine - 1, $("<div>").addClass("editorError").html("<i class='fa fa-exclamation-circle'></i> " + err)[0], {coverGutter: true, noHScroll: true})
+        }
       }
       }
 
 
       codeMirror.setSize("95%", $(window).height() - 270 - $("#queryPane .alert-error").outerHeight() - $(".nav-tabs").outerHeight());
       codeMirror.setSize("95%", $(window).height() - 270 - $("#queryPane .alert-error").outerHeight() - $(".nav-tabs").outerHeight());