Parcourir la source

throw if could not get id from server

ericz il y a 12 ans
Parent
commit
c36e1be28f
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      lib/peer.js

+ 4 - 0
lib/peer.js

@@ -82,6 +82,10 @@ Peer.prototype._retrieveId = function(cb) {
     http.open('get', url, true);
     http.onreadystatechange = function() {
       if (http.readyState === 4) {
+        if (http.status !== 200) {
+          throw 'Retrieve id response not 200';
+          return;
+        }
         self.id = http.responseText;
         self._init();
       }