Page MenuHomePhabricator

Show the stack trace on error when using the debug console
Closed, ResolvedPublic


It would be nice if errors in the debug console showed the stack trace as well as the error message.

For a function f(...) that produces an error, you can get the stack trace with this code:

xpcall(function() return f(...) end, debug.traceback)

However, it can be a pain to type this out every time you want a stack trace, and newer coders might not be aware that this feature of Lua exists. And in my experience, if you get an error in the debug console, more often than not you want to see the stack trace.

If screen real estate is thought to be a problem then the stack trace could be collapsible, but personally I don't think any extra formatting is necessary.

Version: unspecified
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:46 AM
bzimport set Reference to bz72462.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 16874
Screenshot of the current debug console error behaviour

This screenshot shows the current error behaviour in the debug console, first with a function producing an error, and then with the strack trace for that error as found with xpcall.


Current_debug_console_error_behaviour.png (539×1 px, 30 KB)

MrStradivarius set Security to None.

Change 220704 had a related patch set uploaded (by Jackmcbarn):
Display backtraces in the Scribunto console

Change 220704 merged by jenkins-bot:
Display backtraces in the Scribunto console

Jackmcbarn claimed this task.