diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-03-17 11:46:21 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-03-17 11:46:21 +0000 |
commit | 8f7b5afe192f0946514bc8fb1d1e78b4ebb5ab8a (patch) | |
tree | d5492ff59ad9cb58aa5386f964977649014b12b9 | |
parent | 1b96a40a135b51a3fb348c1d76e7658407bca53e (diff) | |
download | prosody-8f7b5afe192f0946514bc8fb1d1e78b4ebb5ab8a.tar.gz prosody-8f7b5afe192f0946514bc8fb1d1e78b4ebb5ab8a.zip |
util.async: Convert asserts to a return false (same as other unexpected behaviour)
-rw-r--r-- | util/async.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/async.lua b/util/async.lua index 205db183..0dde1f32 100644 --- a/util/async.lua +++ b/util/async.lua @@ -24,8 +24,10 @@ local function runner_continue(thread) -- Find the 'level' of the top-most function (0 == current level, 1 == caller, ...) while debug.getinfo(thread, level, "") do level = level + 1; end ok, runner = debug.getlocal(thread, level-1, 1); - assert(ok == "self", "unexpected async state: variable mismatch"); - assert(runner.thread == thread, "unexpected async state: thread mismatch"); + if ok ~= "self" or runner.thread ~= thread then + log("warn", "unexpected async state: unable to locate runner during error handling, got %s", ok); + return false; + end local error_handler = runner.watchers.error; if error_handler then error_handler(runner, debug.traceback(thread, err)); end local ready_handler = runner.watchers.ready; |