Specifically only catch UnicodeDecodeError in IRCSocket.read

This commit is contained in:
jesopo 2019-03-06 17:02:58 +00:00
parent 1dad4827b6
commit c842c459f4

View file

@ -105,12 +105,12 @@ class Socket(IRCObject.Object):
for line in data_lines:
try:
decoded_line = line.decode(self._encoding)
except:
except UnicodeDecodeError:
self.log.trace("can't decode line with '%s', falling back",
[self._encoding])
try:
decoded_line = line.decode(self._fallback_encoding)
except:
except UnicodeDecodeError:
continue
decoded_lines.append(decoded_line)