瀏覽代碼

peer-disconnected could be confused for a peer disconnecting rather than your peer being disconnected from the server.

Michelle Bu 12 年之前
父節點
當前提交
5fbdaf0c85
共有 3 個文件被更改,包括 4 次插入4 次删除
  1. 1 1
      changelog.md
  2. 1 1
      docs/api.md
  3. 2 2
      lib/peer.js

+ 1 - 1
changelog.md

@@ -1,7 +1,7 @@
 # PeerJS Changelog
 
 ## Version 0.2.1 (Pending)
-* **Warning**: this build changes the error of type `peer-destroyed` to `peer-disconnected`.
+* **Warning**: this build changes the error of type `peer-destroyed` to `server-disconnected`.
 * Browser detection added. If an incompatible browser is detected, the `browser-incompatible` error is emitted from the `Peer`.
 * Added a `.disconnect()` method to `Peer`, which can be called to close connections to the PeerServer (but not any active DataConnections).
 

+ 1 - 1
docs/api.md

@@ -99,7 +99,7 @@ The `error` object also has a `type` parameter that may be helpful in responding
   * `socket-error`: An error from the underlying socket.
   * `socket-closed`: The underlying socket closed unexpectedly.
 * (The Peer object is destroyed after one of the errors above are emitted.)
-* `peer-disconnected`: A Peer that has been disconnected is being used to try to connect.
+* `server-disconnected`: A Peer that has been disconnected is being used to try to connect.
 
 ### Event: 'close'
 

+ 2 - 2
lib/peer.js

@@ -234,8 +234,8 @@ Peer.prototype._cleanup = function() {
  * is waiting for an ID. */
 Peer.prototype.connect = function(peer, options) {
   if (this.disconnected) {
-    var err = new Error('This Peer has been disconnected from the server and');
-    err.type = 'peer-disconnected';
+    var err = new Error('This Peer has been disconnected from the server and can no longer make connections.');
+    err.type = 'server-disconnected';
     this.emit('error', err);
     return;
   }