浏览代码

throw if could not get id from server

ericz 12 年之前
父节点
当前提交
c36e1be28f
共有 1 个文件被更改,包括 4 次插入0 次删除
  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();
       }