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

It would be nice to have better error identification. #2199

Open
Codinablack opened this issue Mar 26, 2024 · 3 comments
Open

It would be nice to have better error identification. #2199

Codinablack opened this issue Mar 26, 2024 · 3 comments

Comments

@Codinablack
Copy link

Right now when you get a simple error such as "String expected got table" you have to have either been retrying your script after each line edit to know where to look, or have a good feeling because you have been testing many things.

What would be nice is if the error told you the line of which the error occurred on. This could help more people figure out their own problems before having to seek help here.

@Jarod42
Copy link
Contributor

Jarod42 commented Mar 28, 2024

Most of those errors come from Lua directly.

@Codinablack
Copy link
Author

It has been my experience with everything lua I have ever interacted with (except for this obviously), always identifies the line as well as the value or function that contained a value other than expected. So instead of getting "String expected got table" it would say something like :

"error on line 172 with "coolvar" string expected got nil value
file </user/location/directory/filename.lua> line 127 callstack "coolfunc()" "

Something to that degree. It doesn't have to be super detailed with an entire call stack (but that would be of most use), but at least the line where the error occurs and the variable name, that would be very beneficial.

That would be really awesome to have something like that

@fsfod
Copy link

fsfod commented Apr 16, 2024

As a workaround I just ended up modifying _premake_main.lua to wrap the entry point in a xpcall to get a full stack trace

  local function main()
    p.callArray(m.elements)
  end

  function _premake_main()
    local success, result = xpcall(main, debug.traceback)
    if not success then
      print(result)
      return 1
    end
    return 0
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants