[fusion-commits] r1584 - branches/fusion-1.1/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Oct 9 10:35:57 EDT 2008


Author: madair
Date: 2008-10-09 10:35:57 -0400 (Thu, 09 Oct 2008)
New Revision: 1584

Modified:
   branches/fusion-1.1/lib/fusion.js
Log:
re #93: provide better error detection and reporting

Modified: branches/fusion-1.1/lib/fusion.js
===================================================================
--- branches/fusion-1.1/lib/fusion.js	2008-10-03 13:50:01 UTC (rev 1583)
+++ branches/fusion-1.1/lib/fusion.js	2008-10-09 14:35:57 UTC (rev 1584)
@@ -211,7 +211,6 @@
     aUnitAbbr: ['unk', 'in', 'ft', 'yd', 'mi', 'nm', 
                 'mm', 'cm', 'm', 'km', 
                 '°', '°', '°', 'px'],
-    REALLY_SMALL_SCALE: 1000000000,
     
     /**
      * Function: initialize
@@ -644,17 +643,15 @@
         eval("o="+r.responseText);
         callback(o);
       } else {
-        //this check only works on Firefox - it is safely ignored in IE and IE
-        //will happily parse an invalid XML document
-        if (r.responseXML.documentElement.nodeName == 'parsererror') {
-          Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL, 
-              'invalid XML document: ' + r.url));
+        if (r.status >= 400) {
+            Fusion.reportError(new Fusion.Error(Fusion.Error.FATAL, 
+              'xml2json: invalid XML document: ' + r.statusText  + " : " + r.request.url));
+            return;
         }
           
         var options = {
           onSuccess: callback,
           method: 'post',
-          //parameters = 'xml='+encodeURIComponent(r.responseText.replace(/\\/g, '\\\\\\\\'));
           parameters: {'xml': encodeURIComponent(r.responseText)}
         };
         var sl = Fusion.getScriptLanguage();
@@ -816,7 +813,7 @@
     
     require: function(url) { this.queueScript(url); },
     
-    reportError: function(o) { console.log(o.message); this.triggerEvent(Fusion.Event.FUSION_ERROR, o); },
+    reportError: function(o) { this.triggerEvent(Fusion.Event.FUSION_ERROR, o); },
     
     unitFromName: function(unit) {
         switch(unit.toLowerCase()) {



More information about the fusion-commits mailing list