This replacement limits the shown stack frames to only relevant information (this is actually slightly variable, since you can pass in an offset to the builder function), from the error/assert call up to just below love.run (this might cause issues if you're testing a love.run implementation). Additionally, Catcher lets you move up and down the stack to inspect a frame's locals, there was a lot of pain involved in getting parameters ordered correctly, especially taking varargs into account.
The formatting isn't perfect, notably if a frame is too long (wraps), the cursor column won't align with it anymore, but line wrapping works fine with error messages and locals. You can also pass the builder function a custom_fmt table to change certain aspects of the result, in the attached screenshot, clear_color is set to black.
It tries to be similar to the default function controls-wise, retaining ctrl-c to copy and escape to exit, but also provides the stack cursor and ctrl-t to start the console debugger (can also be swapped out for a custom function).
Here's an example usage, with the default arguments:
Code: Select all
love.errorhandler = require("catcher").errorhandler({
frame = " %name:%currentline @ (%short_src:%linedefined)\n",
lclvar = "\t%name = %value\n",
clear_color = {89/255, 157/255, 220/255},
text_color = {1, 1, 1},
text_size = 14,
inset = 70
}, debug.debug, 0, nil)