attempt at better error recovery
[?]
Apr 20, 2023, 6:23 AM
K7ABD3WDOLPPQOQGDVMTMEIHDAPOTMHPEL65XEGBITIW4MHVH75QCDependencies
- [2]
BXXTVMBQbetter organization of errors - [3]
5PC2IJZAbackport some improvements from template-live-editor - [4]
5UT4ZUMMremove a local - [5]
IOGZEHCWdocument available modes - [6]
JUTECG5Xbring template-live's protocol in sync with template-live-editor - [7]
ZFLAXEIJdrop non-existent arg in callback - [8]
TK4G4GMCexpose a command for the driver to remotely restart an app - [9]
4H4JTSFImouse wheel support - [10]
TNRO6KLZnew live app - [11]
OJLXS67Na prefix for metadata in the manifest - [12]
EY6UKABArecord support for multiple versions - [13]
UUX7J2OAprevent overriding foundational definitions - [14]
NTOJPPQNmove temporary file out of user directory (if possible)
Change contents
- replacement in main.lua at line 22
-- available modes: run, version_checkMode = 'version_check'-- available modes: run, errorMode = 'run'Error_message = nilError_count = 0-- we'll reuse error mode on load for an initial version check - edit in main.lua at line 42
-- version check - replacement in main.lua at line 45
if array.find(Supported_versions, Version) thenMode = 'run'if array.find(Supported_versions, Version) == nil thenMode = 'error'Error_message = ("This app doesn't support version %s; please use version %s. Press any key to try it with this version anyway."):format(Version, Supported_versions[1])print(Error_message)-- continue initializing everything; hopefully we won't have errors during initialization - edit in main.lua at line 120
-- listen for commands in both 'error' and 'run' modes - edit in main.lua at line 125
Mode = 'run' - replacement in main.lua at line 130
if on.update then on.update(dt) endif Mode == 'run' thenif on.update then on.update(dt) endend - replacement in main.lua at line 315
if Mode == 'version_check' thenif Mode == 'error' then - replacement in main.lua at line 319
love.graphics.print(("This app doesn't support version %s; please use version %s. Press any key to try it with this version anyway."):format(Version, Supported_versions[1]), 40, 40)love.graphics.printf(Error_message, 40, 40, 600) - replacement in main.lua at line 326
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 336
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 343
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 348
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 356
if Mode == 'version_check' then return endif Mode == 'error' thenif key == 'c' thenlove.system.setClipboardText(Error_message)endreturnend - replacement in main.lua at line 370
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 379
if Mode == 'version_check' thenif Mode == 'error' then - replacement in main.lua at line 387
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 392
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 397
if Mode == 'version_check' then return endif Mode == 'error' then return end - replacement in main.lua at line 445
-- draw a pause indicator on screenlove.graphics.setColor(1,0,0)love.graphics.rectangle('fill', 10,10, 3,10)love.graphics.rectangle('fill', 16,10, 3,10)love.graphics.present()-- print stack trace here just in case we ran the app through a terminalMode = 'error' - edit in main.lua at line 447
print(stack_trace)print('Look in the driver for options to investigate further.')print("(You probably can't close the app window at this point. If you don't have the driver set up, you might need to force-quit.)")-- send stack trace to driver and wait for a response - replacement in main.lua at line 448[2.330]→[6.11676:11721](∅→∅),[6.11676]→[6.11676:11721](∅→∅),[6.11721]→[3.257:285](∅→∅),[3.285]→[6.11721:11773](∅→∅),[6.11721]→[6.11721:11773](∅→∅)
local bufrepeatbuf = app.receive()love.timer.sleep(0.001)until bufif buf == 'QUIT' thenreturn trueError_message = 'Something is wrong. Sorry!\n\n'..stack_trace..'\n\n'.."(Note: function names above don't include outer tables. So functions like on.draw might show up as just 'draw', etc.)\n\n"..'Options:\n'..'- press "c" (without the quotes) to copy this message to your clipboard to send to me: ak@akkartik.com\n'..'- press any other key to retry, see if things start working again\n'..'- run driver.love to try to fix it yourself. As you do, feel free to ask me questions: ak@akkartik.com\n'Error_count = Error_count+1if Error_count > 1 thenError_message = Error_message..('\n\nThis is error #%d in this session; things will probably not improve in this session. Please copy the message and send it to me: ak@akkartik.com.'):format(Error_count) - replacement in main.lua at line 458
app.run(buf)print(Error_message)