[fusion-commits] r3030 - trunk/lib
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Mar 8 06:58:57 PST 2018
Author: jng
Date: 2018-03-08 06:58:57 -0800 (Thu, 08 Mar 2018)
New Revision: 3030
Modified:
trunk/lib/fusion.js
Log:
If a bad app def resource id is passed in, it show alert early about this problem as TraceKit and its error reporting/displaying infrastructure may not be ready at this point.
Fixes #660
Modified: trunk/lib/fusion.js
===================================================================
--- trunk/lib/fusion.js 2018-03-08 14:30:34 UTC (rev 3029)
+++ trunk/lib/fusion.js 2018-03-08 14:58:57 UTC (rev 3030)
@@ -1676,37 +1676,43 @@
appDefUrl.indexOf('Session') == 0)) {
var fetchAppDef = function(appDefUrl, sessionId) {
- var xhr = new getXmlHttpRequest();
+ var xhr = getXmlHttpRequest();
var mapAgentUrl = getAgentUrl();
xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ sessionId, false);
- xhr.send(null);
- var appDefXML = xhr.responseXML.documentElement;
+ try {
+ xhr.send(null);
+ var appDefXML = xhr.responseXML.documentElement;
- if (appDefXML) {
- var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0];
- var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0];
- var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0];
- var osmElement = appDefXML.getElementsByTagName("OpenStreetMapScript")[0];
- var stamenElement = appDefXML.getElementsByTagName("StamenScript")[0];
+ if (appDefXML) {
+ var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0];
+ var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0];
+ var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0];
+ var osmElement = appDefXML.getElementsByTagName("OpenStreetMapScript")[0];
+ var stamenElement = appDefXML.getElementsByTagName("StamenScript")[0];
- addElement(googleElement);
- addElement(yahooElement);
- addElement(veElement);
- addElement(osmElement);
- addElement(stamenElement);
+ addElement(googleElement);
+ addElement(yahooElement);
+ addElement(veElement);
+ addElement(osmElement);
+ addElement(stamenElement);
- var bingMapKeyElement = appDefXML.getElementsByTagName("BingMapKey")[0];
- if (bingMapKeyElement) {
- var bingMapKey = bingMapKeyElement.textContent;
- if (!bingMapKey)
- bingMapKey = bingMapKeyElement.text;
- Fusion.bingMapKey = bingMapKey;
+ var bingMapKeyElement = appDefXML.getElementsByTagName("BingMapKey")[0];
+ if (bingMapKeyElement) {
+ var bingMapKey = bingMapKeyElement.textContent;
+ if (!bingMapKey)
+ bingMapKey = bingMapKeyElement.text;
+ Fusion.bingMapKey = bingMapKey;
+ }
}
+ } catch (e) {
+ if (xhr.statusText == "MgResourceNotFoundException") {
+ alert("Failed to fetch Application Definition. The specified resource could not be found");
+ } //Anything else we can't do anything about as TraceKit is probably not loaded yet
}
};
var getSiteVersion = function(sessionId) {
- var xhr = new getXmlHttpRequest();
+ var xhr = getXmlHttpRequest();
var mapAgentUrl = getAgentUrl();
xhr.open("GET", mapAgentUrl + "?OPERATION=GETSITEVERSION&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&SESSION="+ sessionId, false);
xhr.send(null);
More information about the fusion-commits
mailing list