better error message & minor comment

This commit is contained in:
caryoscelus 2022-01-07 11:23:59 +00:00
parent 296e0dbb57
commit 00235a0288

View file

@ -157,10 +157,11 @@ class Peer(object):
for retry in range(1, 4): # Retry 3 times for retry in range(1, 4): # Retry 3 times
try: try:
if not self.connection: if not self.connection:
# this is redundant, already established that self.connection is present
raise Exception("No connection found") raise Exception("No connection found")
res = self.connection.request(cmd, params, stream_to) res = self.connection.request(cmd, params, stream_to)
if not res: if not res:
raise Exception("Send error") raise Exception("Send error : result is empty")
if "error" in res: if "error" in res:
self.log("%s error: %s" % (cmd, res["error"])) self.log("%s error: %s" % (cmd, res["error"]))
self.onConnectionError("Response error") self.onConnectionError("Response error")