From 53a6d33628ce800cd41e7d146016d7ae6f9205c9 Mon Sep 17 00:00:00 2001 From: Eero Nevalainen Date: Thu, 3 Dec 2015 16:31:45 +0200 Subject: [PATCH] Not all exception messages are actually strings. For example SSLException seems to return just an integer error code from extract_err_message. --- websocket/_socket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/websocket/_socket.py b/websocket/_socket.py index 315c808..b2aaa55 100644 --- a/websocket/_socket.py +++ b/websocket/_socket.py @@ -115,7 +115,7 @@ def send(sock, data): raise WebSocketTimeoutException(message) except Exception as e: message = extract_err_message(e) - if message and "timed out" in message: + if isinstance(message, str) and "timed out" in message: raise WebSocketTimeoutException(message) else: raise