This approach tries to address both. Press any key to retry, or show the error right on the window while I whip out driver.love. You can also copy the message to the clipboard by hitting 'c'.
Drawbacks of this approach:
The best plan is still to not rely on this too much. Don't ship bugs.
FG6P6EABVGCUBWJSHUP4W7FFOVEQ74UP4D6PHHVHH4UWXHQCOXHAC
HFZYVVLRDT7XG4JTRAJCCDMD7ZICQTKGKTPVF7XPBD7MOJO4Z2VAC
ZJPFAJVMVVKNZCQPQPCHIPCLMG5VRNVUMG5ZY3VR5B57PRNFJAOAC
OEYPNXNSXNKVCWBHS3CJVZMBXZJSBJUD5HVGZTHDLMT5H2C74EPAC
R4PMTRF75RCAYGFCEPWKF6YE73YCHW5S36F76O3FWIQVNBKTTNSAC
UWAEK2MUQMCZXGH66IKCUKOJULH4C4VJFARS7RONZVKVLVMXZVLAC
4ULMOX2DU6EKVUDEVNVVD3LPKR7FL46KXE5M7R3UGAVWUQHLO2JAC
C6AT7PEUHQMNRTF2EJOGDDULKPZRF3SRUXTNUSIAKTWFIN4ILZEQC
if array.find(Supported_versions, Version) then
Mode = 'run'
if array.find(Supported_versions, Version) == nil then
Mode = '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
-- draw a pause indicator on screen
love.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 terminal
Mode = 'error'
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
local buf
repeat
buf = app.receive()
love.timer.sleep(0.001)
until buf
if buf == 'QUIT' then
return true
Error_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+1
if Error_count > 1 then
Error_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)