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

no strack trace in callback errors #124

Open
wolfiestyle opened this issue Nov 16, 2015 · 0 comments
Open

no strack trace in callback errors #124

wolfiestyle opened this issue Nov 16, 2015 · 0 comments

Comments

@wolfiestyle
Copy link

Currently when an error occurs inside a callback, it displays the error message via a gtk warning, but it doesn't display a proper stack trace like a normal Lua error. This makes debugging problems inside callbacks hard.

Example code:

local lgi = require "lgi"
local Gtk = lgi.Gtk

local function evil_code(w)
    w:add(nil)
end

local function some_stuff(w)
    evil_code(w)
end

local window = Gtk.Window{
    on_destroy = Gtk.main_quit,
    Gtk.Button{
        label = "Click to crash",
        margin = 10,
        on_clicked = function(w)
            some_stuff(w)
        end
    }
}

window:show_all()
Gtk.main()

example output after causing an error:

(lua:4090): Lgi-WARNING **: Error raised while calling 'lgi.cbk (function: 0x1001410): GObject': /usr/local/share/lua/5.1/lgi/override/Gtk.lua:139: bad argument #3 to 'add' (Gtk.Widget expected, got nil)

expected output: a full stack trace similar to this

lua: ./error_test.lua:6: attempt to index local 'w' (a nil value)
stack traceback:
    ./error_test.lua:6: in function 'evil_code'
    ./error_test.lua:10: in function 'some_stuff'
    ./error_test.lua:14: in function <./error_test.lua:13>
    ./error_test.lua:15: in main chunk

Using lgi 0.9.0 under Gentoo Linux x86_64, with Gtk 3.16.7

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

No branches or pull requests

1 participant