resolve conflicts

akkartik
Nov 10, 2023, 6:18 PM
BQH7ANWMOV3WODWYEC2AH4QGBMJRNIO2TAHHQBYHVXYWJKDZLG6AC

Dependencies

  • [2] 3BRGOF7N return failing tests with every code change
  • [3] XJEVMWTS remove a no-op regex munging on callstacks
  • [4] AFZEVZOU resolve conflicts
  • [5] 3QNOKBFM beginnings of a test harness
  • [6] TBWAE64A app is now live, can communicate with driver
  • [7] QFURHRTP rename globals to have a single uppercase letter
  • [8] CUFW4EJL reorganize app.lua and its comments
  • [9] GXE3ESLG abstraction: roll forward/back
  • [10] D6T6FIO4 unnecessary coercion
  • [11] LRDM35CE app running again
  • [12] FFMMA7L2 send Test_failures _before_ restoring globals
  • [13] T7QIIGQ6 attempt at better error recovery
  • [14] BSDXVB3H backport some doc updates and renames
  • [15] BZDYEW4M don't also send success on error
  • [16] R6MB3UPB Merge text.love
  • [17] NLU6BXIR clean up some cruft from error callstacks
  • [18] AGJXIDOF hardcode some assumptions about how this app uses love
  • [19] 45BU7IRV remove a local

Change contents

  • replacement in live.lua at line 204
    [5.7983][5.816:867]()
    live.send_to_driver('ERROR '..tostring(err))
    [5.7983]
    [2.9]
    live.send_to_driver('ERROR '..cleaned_up_frame(tostring(err)))
  • replacement in live.lua at line 377
    [5.1287][3.0:86](),[3.86][5.976:1026](),[5.1395][5.976:1026](),[5.10619][5.976:1026](),[5.1026][5.1396:1470]()
    local stack_trace = debug.traceback('Error: ' .. tostring(err), --[[stack frame]]2)
    live.send_run_time_error_to_driver(stack_trace)
    Error_message = 'Something is wrong. Sorry!\n\n'..stack_trace..'\n\n'..
    [5.1287]
    [5.1470]
    local callstack = debug.traceback('', --[[stack frame]]2)
    local cleaned_up_error = 'Error: ' .. cleaned_up_frame(tostring(err))..'\n'..cleaned_up_callstack(callstack)
    live.send_run_time_error_to_driver(cleaned_up_error)
    Error_message = 'Something is wrong. Sorry!\n\n'..cleaned_up_error..'\n\n'..
  • edit in live.lua at line 392
    [5.10778]
    -- I tend to read code from files myself (say using love.filesystem calls)
    -- rather than offload that to load().
    -- Functions compiled in this manner have ugly filenames of the form [string "filename"]
    -- This function cleans out this cruft from error callstacks.
    -- It also strips out the numeric prefixes we introduce in filenames.
    function cleaned_up_callstack(callstack)
    local frames = {}
    for frame in string.gmatch(callstack, '[^\n]+\n*') do
    table.insert(frames, cleaned_up_frame(frame))
    end
    -- the initial "stack traceback:" line was unindented and remains so
    return table.concat(frames, '\n\t')
    end
    function cleaned_up_frame(frame)
    local line = frame:gsub('^%s*(.-)\n?$', '%1')
    local filename, rest = line:match('([^:]*):(.*)')
    return cleaned_up_filename(filename)..':'..rest
    end
    function cleaned_up_filename(filename)
    -- pass through frames that don't match this format
    -- this includes the initial line "stack traceback:"
    local core_filename = filename:match('^%[string "(.*)"%]$')
    if core_filename == nil then return filename end
    -- strip out the numeric prefixes we introduce in filenames
    local _, core_filename2 = core_filename:match('^(%d+)-(.+)')
    return core_filename2 or core_filename
    end
  • resurrect zombie in app.lua at line 171
    [5.391][5.926:1116](),[5.391][5.926:1116]()
    -- returning nil continues the loop
    end
    -- protect against runtime errors
    return function()
    local status, result = xpcall(App.run_frame, live.handle_error)
    return result
  • resurrect zombie in app.lua at line 180
    [5.1035][5.1035:1040](),[5.1035][5.1035:1040]()
    end