You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/11/14 22:30:54 UTC

incubator-freemarker-online-tester git commit: Fixed poor error message ("undefined: undefined") when the HTTP error response doesn't contain the expected JSON structure

Repository: incubator-freemarker-online-tester
Updated Branches:
  refs/heads/master 8621c4894 -> 5d7e35748


Fixed poor error message ("undefined: undefined") when the HTTP error response doesn't contain the expected JSON structure


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-online-tester/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-online-tester/commit/5d7e3574
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-online-tester/tree/5d7e3574
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker-online-tester/diff/5d7e3574

Branch: refs/heads/master
Commit: 5d7e35748e92f8c216f1ac33cabeddda9cc43c7b
Parents: 8621c48
Author: ddekany <dd...@apache.org>
Authored: Tue Nov 14 23:30:48 2017 +0100
Committer: ddekany <dd...@apache.org>
Committed: Tue Nov 14 23:30:48 2017 +0100

----------------------------------------------------------------------
 src/main/resources/assets/js/script.js        | 6 +++++-
 src/main/resources/view/freemarker-online.ftl | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker-online-tester/blob/5d7e3574/src/main/resources/assets/js/script.js
----------------------------------------------------------------------
diff --git a/src/main/resources/assets/js/script.js b/src/main/resources/assets/js/script.js
index dd0da2b..a088437 100644
--- a/src/main/resources/assets/js/script.js
+++ b/src/main/resources/assets/js/script.js
@@ -66,7 +66,11 @@ function execute() {
     })
     .fail(function (data) {
         if (data.responseJSON) {
-            showResult(data.responseJSON.errorCode + ": " + data.responseJSON.errorDescription, true);              
+        	if (typeof data.responseJSON.errorCode != 'undefined') {
+            	showResult(data.responseJSON.errorCode + ": " + data.responseJSON.errorDescription, true);
+        	} else {
+            	showResult("The service has responded with error (HTTP " + data.status + "; no details available)", true);
+        	}
         } else {
             showResult("The service was unavailable or had returned an invalid response.", true);              
         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker-online-tester/blob/5d7e3574/src/main/resources/view/freemarker-online.ftl
----------------------------------------------------------------------
diff --git a/src/main/resources/view/freemarker-online.ftl b/src/main/resources/view/freemarker-online.ftl
index 5152a4b..699dfc2 100644
--- a/src/main/resources/view/freemarker-online.ftl
+++ b/src/main/resources/view/freemarker-online.ftl
@@ -34,7 +34,7 @@
     <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/autosize.js/3.0.8/autosize.min.js"></script>
-    <script src="assets/js/script.js"></script>
+    <script src="assets/js/script.js?v=3"></script>
     <script>
         $(function() {
             // Auto-focus on first form input: