util.async: Fix logic bug that prevented error watcher being called for runners
authorMatthew Wild <mwild1@gmail.com>
Tue, 13 Aug 2013 19:23:00 +0100
changeset 5794 66c3ad5d29ad
parent 5793 e8c79796ead9
child 5795 47c2f71d8314
util.async: Fix logic bug that prevented error watcher being called for runners
util/async.lua
--- a/util/async.lua	Mon Aug 12 13:22:27 2013 +0200
+++ b/util/async.lua	Tue Aug 13 19:23:00 2013 +0100
@@ -103,8 +103,12 @@
 		n = #q;
 	end
 	self.state = state;
-	if state ~= self.notified_state then
-		self.notified_state = state;
+	if err or state ~= self.notified_state then
+		if err then
+			state = "error"
+		else
+			self.notified_state = state;
+		end
 		local handler = self.watchers[state];
 		if handler then handler(self, err); end
 	end