Error handling
Closed this issue ยท 4 comments
jeparlefrancais commented
Hello ๐
I noticed that errors are getting automatically wrapped up into some opaque type. I can stringify the error and see what was originally thrown, but I can't get back the thrown value. For example, it would be great if I could do something like this:
local function throwError()
error({ message = "error" })
end
local success, err = pcall(throwError)
print("success", success) --> false
print("err", type(err)) --> userdata
print("err.message", err.message) --> throws: attempt to index userdata with 'message'
jeparlefrancais commented
(also I tested it using xpcall
and the error passed to the second callback has the same issue)
filiptibell commented
This is due to how the luau library we use handles errors, I've made an issue to track this over on their repo: mlua-rs/mlua#263
filiptibell commented
Fixed in the new scheduler on the soon-to-be-merged scheduler-rewrite branch, also added a test in 5ccc481 to make sure we don't regress on this
jeparlefrancais commented
Awesome! This is great as it closes a big gap between the Roblox environment and Lune!