Changeset

11:a502c905527c

clix: Handle errors (including 'interrupted!') in verse.loop()
author Matthew Wild <mwild1@gmail.com>
date Thu, 07 Jan 2010 02:31:00 +0000
parents 10:49b83fa1f6fd
children 12:1793fca3d707
files clix.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/clix.lua	Thu Jan 07 02:20:16 2010 +0000
+++ b/clix.lua	Thu Jan 07 02:31:00 2010 +0000
@@ -81,7 +81,13 @@
 	conn.connect_port = account.port;
 	-- Connect!
 	conn:connect_client(account.jid, account.password);
-	return verse.loop();
+	
+	local ok, ret = pcall(verse.loop);
+	if not ok and not ret:match("interrupted!$") then
+		io.stderr:write("Fatal error: ", ret, "\n");
+		return 1;
+	end
+	return err or 0;
 end
 
 table.remove(arg,1);