summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrakiru <rabbitkillrun@googlemail.com>2018-01-11 20:25:39 +0000
committerrakiru <rabbitkillrun@googlemail.com>2018-01-11 20:25:39 +0000
commitdccb4c8132800f9ee84cdfdaa602df76bfa65975 (patch)
tree9f3fe33f9dd091cb5d456e30c031f051db87a71e
parent6f0e48eac4f20894c802c93ac75cfa4693fbaa36 (diff)
Fix attempt to use non-existent name
This theoretically also changes the meaning of the code from running the callback always, to only running the callback when there wasn't an error, which is what I'm assuming was meant, but in pratical terms, attempting to use `data` in the case of an error would have raised a `NameError` anyway. `else` on a try block will only run if nothing was raised.
-rw-r--r--asciifarm/client/connection.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/asciifarm/client/connection.py b/asciifarm/client/connection.py
index 4eb0ffe..251d376 100644
--- a/asciifarm/client/connection.py
+++ b/asciifarm/client/connection.py
@@ -21,7 +21,8 @@ class Connection:
data = receive(self.sock)
except Exception as err:
onError(err)
- callback(data)
+ else:
+ callback(data)
def send(self, message):
send(self.sock, bytes(message, 'utf-8'))