summaryrefslogtreecommitdiff
path: root/asciifarm/client
diff options
context:
space:
mode:
Diffstat (limited to 'asciifarm/client')
-rw-r--r--[-rwxr-xr-x]asciifarm/client/main.py0
-rw-r--r--asciifarm/client/start.py11
2 files changed, 10 insertions, 1 deletions
diff --git a/asciifarm/client/main.py b/asciifarm/client/main.py
index da556ef..da556ef 100755..100644
--- a/asciifarm/client/main.py
+++ b/asciifarm/client/main.py
diff --git a/asciifarm/client/start.py b/asciifarm/client/start.py
index fef5d9e..0c247b5 100644
--- a/asciifarm/client/start.py
+++ b/asciifarm/client/start.py
@@ -23,6 +23,7 @@ def main(name, socketType, address, keybindings, characters, colours=False, logf
print("ERROR: Could not connect to server.\nAre you sure that the server is running and that you're connecting to the right address?", file=sys.stderr)
return
+ error = None
closeMessage = None
os.environ.setdefault("ESCDELAY", "25")
@@ -34,10 +35,18 @@ def main(name, socketType, address, keybindings, characters, colours=False, logf
client.start()
except KeyboardInterrupt:
client.close("^C caught, goodbye")
+ except Exception as e:
+ # throw the execption outside ncurses
+ # so the cleanup can happen first
+ nonlocal error
+ error = e
nonlocal closeMessage
closeMessage = client.closeMessage
-
+
curses.wrapper(start)
+ if error is not None:
+ raise error
+
if closeMessage:
print(closeMessage, file=sys.stderr)