fixed #152 - set error message.

This commit is contained in:
liris
2015-02-24 09:50:05 +09:00
parent 9d93216c13
commit dc3017dbc7
3 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,10 @@
ChangeLog ChangeLog
============ ============
- 0.26.0
- all WebSocketException provide message string (#152)
- 0.25.0 - 0.25.0
- fixed for Python 2.6(#151) - fixed for Python 2.6(#151)

View File

@@ -96,7 +96,7 @@ class WebSocketApp(object):
""" """
if not self.sock or self.sock.send(data, opcode) == 0: if not self.sock or self.sock.send(data, opcode) == 0:
raise WebSocketConnectionClosedException() raise WebSocketConnectionClosedException("Connection is already closed.")
def close(self): def close(self):
""" """
@@ -164,7 +164,7 @@ class WebSocketApp(object):
break break
if ping_timeout and self.last_ping_tm and time.time() - self.last_ping_tm > ping_timeout: if ping_timeout and self.last_ping_tm and time.time() - self.last_ping_tm > ping_timeout:
self.last_ping_tm = 0 self.last_ping_tm = 0
raise WebSocketTimeoutException() raise WebSocketTimeoutException("ping timed out")
if r: if r:
op_code, frame = self.sock.recv_data_frame(True) op_code, frame = self.sock.recv_data_frame(True)

View File

@@ -952,7 +952,7 @@ class WebSocket(object):
self.sock.close() self.sock.close()
self.sock = None self.sock = None
self.connected = False self.connected = False
raise WebSocketConnectionClosedException() raise WebSocketConnectionClosedException("Connection is already closed.")
return bytes return bytes
def _recv_strict(self, bufsize): def _recv_strict(self, bufsize):