[fusion-commits] r1585 - trunk/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Oct 9 10:38:20 EDT 2008


Author: madair
Date: 2008-10-09 10:38:20 -0400 (Thu, 09 Oct 2008)
New Revision: 1585

Modified:
   trunk/lib/fusion.js
Log:
closes #93: provide better error detection and reporting - applied to trunk

Modified: trunk/lib/fusion.js
===================================================================
--- trunk/lib/fusion.js	2008-10-09 14:35:57 UTC (rev 1584)
+++ trunk/lib/fusion.js	2008-10-09 14:38:20 UTC (rev 1585)
@@ -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