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.
K7ABD3WDOLPPQOQGDVMTMEIHDAPOTMHPEL65XEGBITIW4MHVH75QC
BXXTVMBQJYLA43IHDYYUBKBVEQKKIDD5FSYMSYFXD5BCCLLPJZ3QC
5PC2IJZAAAMT3KBPHDB37XLQF7LG7WYR7TGSHNL2LFLRCIOR3LAAC
5UT4ZUMMYI5WB76PY4R5TYPQSVEDDGIWTRREDUL5457RMPLG7RBQC
IOGZEHCWRWYVQBE2X4SMHET33RP6KWN5JE6J3GKWLVULE4GCE4VQC
EY6UKABATZRTWERQUPG7RCQVVW2NG7DUAAJ3UTNSAYXGNXMNMTLQC
TNRO6KLZXIZUFWKCXSWAJHN2CMHS56ATGGULOKMJC2YNCFRJZKLAC
JUTECG5XRUNBOJIPKEYZ4I2225AAOCGQKVJN2UAENUBZK2FG2XGAC
ZFLAXEIJTHPCHS2WFOVAF65GY5Q2ZEW5FM4VZORFMCIHU6XIVXGAC
4H4JTSFIHMKJROTRE6CC5X6SWUNDT4CKEDSQOCFEAND3NQKFFTCQC
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)