Skip to content

Commit d1161cd

Browse files
authored
Fix NoYield to give a useful stack trace in all cases (#27)
1 parent 576767d commit d1161cd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/NoYield.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
local function resultHandler(co, ok, ...)
1111
if not ok then
12-
local err = (...)
13-
error(err, 2)
12+
local message = (...)
13+
error(debug.traceback(co, message), 2)
1414
end
1515

1616
if coroutine.status(co) ~= "dead" then

lib/NoYield.spec.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ return function()
5151

5252
expect(ok).to.equal(false)
5353
expect(err:find("foo")).to.be.ok()
54+
expect(err:find("NoYield.spec")).to.be.ok()
5455
end)
5556
end

0 commit comments

Comments
 (0)