JSDO properties, methods, and events reference : lastSessionXHR property
  

lastSessionXHR property

Returns an object reference to the XMLHttpRequest object (XHR) that was most recently used by the progress.data.Session object to execute a Session object method.
The one exception is in the case of a successful invocation of the logout( ) method, in which case lastSessionXHR is set to null.
Note: This does not include the XMLHttpRequest objects that a Session object helps to prepare for JSDO server requests (Data Object operations).
Data type: Object
Access: Read-only
Applies to: progress.data.Session class
It is possible for a Session object method to fail prior to sending a request to the web server. This is especially true of the addCatalog( ) method. If a Session object method fails before sending the request, lastSessionXHR is the most recent XHR returned from a previous method call that did send a request to the web server. For example, if login( ) fails with an authentication error on the web server, and the application follows with a call to addCatalog( ), addCatalog( ) throws an error. However, lastSessionXHR then returns the XHR used for the unsuccessful login( ) request instead of for the failed addCatalog( ) call, because addCatalog( ) never attempts to send its own request and therefore doesn't create an XHR.
In general, you can use the XHR returned by this property to find out more information about the results of a web server request than you can identify from the error code returned, or the error object thrown, by a given Session object method. One possible scenario is that the request to the server can succeed, but the body of the response, which should contain the catalog, contains data that cannot be parsed successfully as a Data Service Catalog.

Example

The following code fragment might provide more information about what has gone wrong when a possibly invalid Data Service Catalog is loaded for a session:
// create Session
pdsession = new progress.data.Session();

// log in
pdsession.login('http://testmach:8980/SportsMobileApp');

// load catalog

try {
  pdsession.addCatalog(
"http://testmach:8980/SportsMobileApp/static/CustomerSvc.json");
}
catch(e) {
  var xhr = pdsession.lastSessionXHR;
  if ( xhr ) {
    if (xhr.status === 200 ) { // did HTTP request succeed?
      // probably something wrong with the catalog, dump it
      if (xhr.responseText) {
        console.log(xhr.responseText);
      }
    }
  }
}

See also:

addCatalog( ) method (Session class), login( ) method (Session class), logout( ) method (Session class)