Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/pazpar2
authorMike Taylor <mike@miketaylor.org.uk>
Thu, 19 Nov 2009 16:33:09 +0000 (16:33 +0000)
committerMike Taylor <mike@miketaylor.org.uk>
Thu, 19 Nov 2009 16:33:09 +0000 (16:33 +0000)
1  2 
js/pz2.js

diff --combined js/pz2.js
+++ b/js/pz2.js
@@@ -1,4 -1,5 +1,4 @@@
  /*
 -** $Id: pz2.js,v 1.70 2008-03-12 11:36:57 jakub Exp $
  ** pz2.js - pazpar2's javascript client library.
  */
  
@@@ -250,6 -251,7 +250,7 @@@ pz2.prototype 
          this.termCounter = 0;
          this.bytargetCounter = 0;
          this.statCounter = 0;
+         this.activeClients = 1;
          
          // no proxy mode
          if( !this.initStatusOK )
@@@ -749,7 -751,7 +750,7 @@@ pzHttpRequest.prototype 
          for (var key in this.requestHeaders)
              this.request.setRequestHeader(key, this.requestHeaders[key]);
          this.request.onreadystatechange = function () {
 -            context._handleResponse();
 +            context._handleResponse(url); /// url used ONLY for error reporting
          }
          this.request.send(data);
      },
              return this.url;
      },
  
 -    _handleResponse: function ()
 +    _handleResponse: function (savedUrlForErrorReporting)
      {
          if ( this.request.readyState == 4 ) { 
              // pick up appplication errors first
                  else {
                      throw err;
                  }
 +            } else if (this.request.status == 200 && 
 +                       this.request.responseXML == null) {
 +                var err = new Error("XML response is empty but no error " +
 +                                    "for " + savedUrlForErrorReporting);
 +                err.code = -1;
 +                if (this.errorHandler) {
 +                    this.errorHandler(err);
 +                } else {
 +                    throw err;
 +                }
              } else if (this.request.status == 200) {
                  this.callback(this.request.responseXML);
              } else {