You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/05/23 23:01:50 UTC
svn commit: r541115 - in /incubator/xap/trunk/codebase/src/xap:
data/datasource/AbstractDataSource.js log/Logger.js
requestservice/RequestService.js session/ClientSession.js
session/EventHandler.js util/XapException.js
Author: jmargaris
Date: Wed May 23 16:01:48 2007
New Revision: 541115
URL: http://svn.apache.org/viewvc?view=rev&rev=541115
Log:
better exception handling for bad urls
Modified:
incubator/xap/trunk/codebase/src/xap/data/datasource/AbstractDataSource.js
incubator/xap/trunk/codebase/src/xap/log/Logger.js
incubator/xap/trunk/codebase/src/xap/requestservice/RequestService.js
incubator/xap/trunk/codebase/src/xap/session/ClientSession.js
incubator/xap/trunk/codebase/src/xap/session/EventHandler.js
incubator/xap/trunk/codebase/src/xap/util/XapException.js
Modified: incubator/xap/trunk/codebase/src/xap/data/datasource/AbstractDataSource.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/datasource/AbstractDataSource.js?view=diff&rev=541115&r1=541114&r2=541115
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/datasource/AbstractDataSource.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/datasource/AbstractDataSource.js Wed May 23 16:01:48 2007
@@ -373,7 +373,7 @@
* @private
* Callback method for asynchronous data loading.
*/
-xap.data.datasource.AbstractDataSource.prototype.requestFailed = function (a, e) {
+xap.data.datasource.AbstractDataSource.prototype.requestFailed = function (a, response, e) {
this.getSession().handleException(e);
this.fireOnDataRetrieveFailure(e);
};
@@ -398,6 +398,7 @@
/**
*
+ * TODO make this take a netservice listener that the user can specify
*
* Asynchronously loads a source object from a server URL. When the loading is complete
* the data source will refresh and any bindings will re-resolve.
Modified: incubator/xap/trunk/codebase/src/xap/log/Logger.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/log/Logger.js?view=diff&rev=541115&r1=541114&r2=541115
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/log/Logger.js (original)
+++ incubator/xap/trunk/codebase/src/xap/log/Logger.js Wed May 23 16:01:48 2007
@@ -443,7 +443,7 @@
this._renderedMessage = '[' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() + ' ' + xap.log.Logger.LEVEL_NAMES[level] + ' ' + logName +'] ' + message;
if (exception){
- this._renderedMessage += ' exception: ' + xap.util.XapException.exceptionToString(exception);
+ this._renderedMessage += xap.util.XapException.exceptionToString(exception);
}
}
Modified: incubator/xap/trunk/codebase/src/xap/requestservice/RequestService.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/requestservice/RequestService.js?view=diff&rev=541115&r1=541114&r2=541115
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/requestservice/RequestService.js (original)
+++ incubator/xap/trunk/codebase/src/xap/requestservice/RequestService.js Wed May 23 16:01:48 2007
@@ -91,7 +91,7 @@
listener.requestFailed(url, response, e);
}
} else {
- listener.requestFailed(url, response);
+ listener.requestFailed(url, response, new xap.util.Exception("Bad response: " + response.status + " - " + response.statusText));
}
}
};
@@ -132,7 +132,7 @@
if (response.status == xap.util.HttpUtils.OK) {
listener.requestCompleted(url, response);
} else {
- listener.requestFailed(url, response);
+ listener.requestFailed(url, response, new xap.util.Exception("Bad response: " + response.status + " - " + response.statusText));
}
}
};
Modified: incubator/xap/trunk/codebase/src/xap/session/ClientSession.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/session/ClientSession.js?view=diff&rev=541115&r1=541114&r2=541115
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/session/ClientSession.js (original)
+++ incubator/xap/trunk/codebase/src/xap/session/ClientSession.js Wed May 23 16:01:48 2007
@@ -183,7 +183,7 @@
xap.session.ClientSession.prototype.handleException = function( exception ) {
//IMPORTANT get rid of handleException entirelty and just use log
- xap.log.Logger.getLogger("exception").error("Exception occured", exception);
+ xap.log.Logger.getLogger("exception").error(xap.util.XapException.exceptionToString(exception));
};
Modified: incubator/xap/trunk/codebase/src/xap/session/EventHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/session/EventHandler.js?view=diff&rev=541115&r1=541114&r2=541115
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/session/EventHandler.js (original)
+++ incubator/xap/trunk/codebase/src/xap/session/EventHandler.js Wed May 23 16:01:48 2007
@@ -106,8 +106,7 @@
}
xap.session.EventHandler.prototype.requestFailed = function(url, response, error ){
- alert("request failed for URL:" + url + " due to " + xap.util.XapException.exceptionToString(error));
- //TODO handle better
+ this._session.handleException(error);
}
xap.session.EventHandler.prototype._handleObjectEvent = function( eventValue, eventElement, clientEvent){
Modified: incubator/xap/trunk/codebase/src/xap/util/XapException.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/util/XapException.js?view=diff&rev=541115&r1=541114&r2=541115
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/util/XapException.js (original)
+++ incubator/xap/trunk/codebase/src/xap/util/XapException.js Wed May 23 16:01:48 2007
@@ -121,11 +121,11 @@
}
else if (exception.getMessage){//should exist for xap exceptions
- s+="Exception:" + exception.getMessage() + "\n";
+ s+="Exception: " + exception.getMessage() + "\n";
}
if (exception.getLocation && exception.getLocation()){
- s+="Occured at:" + exception.getLocation() + "\n";
+ s+="Occured at: " + exception.getLocation() + "\n";
}
if (exception.getCause && exception.getCause()){