Software /
code /
prosody
Comparison
util/async.lua @ 8629:ddb04cacb8b1
util.async: Bump log warnings to error level
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 19 Mar 2018 11:51:40 +0000 |
parent | 8627:24b59a62acce |
child | 8648:ca710a71d730 |
comparison
equal
deleted
inserted
replaced
8628:e88744fa0985 | 8629:ddb04cacb8b1 |
---|---|
35 end | 35 end |
36 | 36 |
37 local function runner_continue(thread) | 37 local function runner_continue(thread) |
38 -- ASSUMPTION: runner is in 'waiting' state (but we don't have the runner to know for sure) | 38 -- ASSUMPTION: runner is in 'waiting' state (but we don't have the runner to know for sure) |
39 if coroutine.status(thread) ~= "suspended" then -- This should suffice | 39 if coroutine.status(thread) ~= "suspended" then -- This should suffice |
40 log("warn", "unexpected async state: thread not suspended"); | 40 log("error", "unexpected async state: thread not suspended"); |
41 return false; | 41 return false; |
42 end | 42 end |
43 local ok, state, runner = coroutine.resume(thread); | 43 local ok, state, runner = coroutine.resume(thread); |
44 if not ok then | 44 if not ok then |
45 local err = state; | 45 local err = state; |
46 -- Running the coroutine failed, which means we have to find the runner manually, | 46 -- Running the coroutine failed, which means we have to find the runner manually, |
47 -- in order to inform the error handler | 47 -- in order to inform the error handler |
48 runner = runner_from_thread(thread); | 48 runner = runner_from_thread(thread); |
49 if not runner then | 49 if not runner then |
50 log("warn", "unexpected async state: unable to locate runner during error handling"); | 50 log("error", "unexpected async state: unable to locate runner during error handling"); |
51 return false; | 51 return false; |
52 end | 52 end |
53 call_watcher(runner, "error", debug.traceback(thread, err)); | 53 call_watcher(runner, "error", debug.traceback(thread, err)); |
54 runner.state, runner.thread = "ready", nil; | 54 runner.state, runner.thread = "ready", nil; |
55 return runner:run(); | 55 return runner:run(); |