Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: coxpcall returns the error message twice #18

Open
Tieske opened this issue Oct 3, 2022 · 0 comments
Open

BUG: coxpcall returns the error message twice #18

Tieske opened this issue Oct 3, 2022 · 0 comments

Comments

@Tieske
Copy link
Member

Tieske commented Oct 3, 2022

This line:

return false, err(debug.traceback(co, (...)), ...)

as part of this function;

function handleReturnValue(err, co, status, ...)
if not status then
return false, err(debug.traceback(co, (...)), ...)
end

The vararg (...) is the result of the function called in protected mode. If that fails with an error "error", the result will become;

	false, "error+stacktrace", "error"

So the error is being returned twice, or more precisely all error results will be shifted by 1.

Since this bug has been in here for ages, and Lua 5.1 is getting obsolete, I'm not providing a PR, just this issue to document it.

Tieske added a commit to lunarmodules/copas that referenced this issue Oct 3, 2022
Tieske added a commit to lunarmodules/copas that referenced this issue Oct 3, 2022
Tieske added a commit to lunarmodules/copas that referenced this issue Oct 3, 2022
Tieske added a commit to lunarmodules/copas that referenced this issue Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant