Forums » Bugs

Lua - Error in error handling

Feb 17, 2023 draugath link
Since the 1.8.631 update, I've been getting a double print of the error message "error in error handling" in my errors.log. I am using Linux.

The error handler appears to be properly processing errors in my main.lua, but I am getting the above error message when there are errors in all of my other files.

I am loading those files with the following function, but it is also happening with use of dofile().

local function loadluafile(...)
    local f, err = loadfile((...))
    assert(f and type(f) == "function", err)
    return f(select(2, ...))
end

I am using this function to be able to send values into the files when they are loaded. This allows me to share local variables in one file with the other files, rather than having everything out in the global space.
Feb 17, 2023 raybondo link
We'll look into the problem. But in the meantime can you call your 'f' function with pcall?
Feb 17, 2023 draugath link
pcall() does not alleviate the problem. I tried the following variations with no success.

pcall(dofile, "myfile.lua")
pcall(loadluafile, "myfile.lua", vars)
return pcall(f, select(2, ...))

Fortunately, plugins without errors work. It's only those with errors that have this problem.
Feb 17, 2023 draugath link
On the off-chance that this is being caused by my code, I've uploaded a version of my current project. There are no errors in the below file. Even something as simple as removing an end in a file causes this problem.
mdi_targetlist_for-testing.zip

main.lua:99
    local function loadluafile(...)

main.lua:333
    loadluafile("api.lua", T)
Feb 17, 2023 raybondo link
A patch was released to fix this issue.