Re: Overriding debug.traceback

  • From: Mike Pall <mike-1403@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 17 Mar 2014 20:03:53 +0100

Paul K wrote:
> What are the alternatives to catch run-time errors from the Lua side
> for chunks you didn't load? For example, the user can initiate
> debugging anywhere in their code and it's convenient to be able to
> break into the debugger when a run-time error happens. The only way I
> could find to support that was to provide a custom debug.traceback
> function, but it seems like it's not going to work with either LuaJIT
> or Lua5.2. Can you suggest any other mechanism? Thank you.

It's a known deficiency of the Lua hook mechanism that it doesn't
enable debuggers to catch errors. AFAIR there have been quite a
few requests on the Lua mailing list in the past, but nothing ever
happened.

And IMHO this needs to work even without any traceback function
attached. So that workaround doesn't solve the problem, anyway.

[Debuggers probably want to catch yields/resumes, too. There are
no hooks for that, either.]

--Mike

Other related posts: