aboutsummaryrefslogtreecommitdiffstats
path: root/util/async.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/async.lua')
-rw-r--r--util/async.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/async.lua b/util/async.lua
index d0bc6c3d..8af8730f 100644
--- a/util/async.lua
+++ b/util/async.lua
@@ -103,8 +103,12 @@ function runner_mt:run(input)
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