From 543f8693426358eda26decafc8cefa2cd2b698e3 Mon Sep 17 00:00:00 2001 From: troido Date: Tue, 2 Jan 2018 23:35:47 +0100 Subject: catch all errors from prompted commands, and print them to the message log --- asciifarm/client/inputhandling.hy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'asciifarm/client/inputhandling.hy') diff --git a/asciifarm/client/inputhandling.hy b/asciifarm/client/inputhandling.hy index 8d19e4a..80043c9 100644 --- a/asciifarm/client/inputhandling.hy +++ b/asciifarm/client/inputhandling.hy @@ -35,7 +35,10 @@ [[key value] (.items (read-str commandsstring))]))) (defn runCommand [self commandstring] - (eval (read-str (+ "(" commandstring ")")))) + (try + (eval (read-str (+ "(" commandstring ")"))) + (except [e Exception] + (self.display.addMessage (repr e))))) (defn parseMessage [self message] (if message -- cgit