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.
T7QIIGQ6YYTTYCVHVEAZSUQ3O4LYBHGPFL4K6D5TA4BA7PND4EJQC
JNVN64RGNEVC2GQ42BTQNTNB3LTOW3X7V34VJ34P2AZOM5WQGO3AC
45BU7IRVZ7ED5QRX7MOWAXDCT5YXG6HERHRLCTYZE5ISJZ5KHKIQC
QMSYY47GBRMJ3FALK2WXLIYZVQ24ZLQXVMEJLQGSU4WSC66D4AZQC
KWIIU3KR3DCWSXVXRLPBK6NP42BMNW2M3EK7VBKWUTW2Z3KMEKAAC
PJ5PQAQEEWQDDEPKP3RURCFDX7SSUIH4GZJCDZ6E6UU6G55KB7KAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC
APX2PY6GAMJSUH7SFSMBFOQJBSAWLLOCKH4L4ZQP2VLHNEXJPREAC
36Z442IVPXHZ7D2QI26YLN3TDDEMDRQ2GKBYQAD6NUHQZVCCY4VAC
TBWAE64A6IIDDXKB6LXDI6WQYAAUYP2QRH3KLM3PUILMVL2BFTTAC
LRDM35CEK3OHXOTB7TEFJRL7P6PQWO5ZG3F2BVA7DIDFHBPJQ7KAC
LXFHXL2NSH7KLRNNN66OPNSU4DXZ6UU2CUPXUHCFEISDB6BY7KDAC
ORKN6EOBUFVAD2TXYW5OIKSL55RU24LOFDTTTXHDZUZ57QRDCY7QC
JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC
IM6GSGVZTVICWIBWRCUXLIMXT3XE3H5LKJ3AITUA4AB3FTW5AJUAC
D6T6FIO4DYWKHG2S3A5GY5NLJBVUXU3XKP7NCFW3E7CSFVSHJB6AC
BSDXVB3HU5Y5FZ244FU2F577RTM6SWEHAZX3IELBVUP52CRFVDSAC
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
if Mode == 'version_check' then
love.graphics.setColor(1,1,0)
love.graphics.rectangle('fill', 30,30, 400,400)
love.graphics.setColor(0,0,0)
love.graphics.printf(("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, 400)
if Mode == 'error' then
love.graphics.setColor(0,0,1)
love.graphics.rectangle('fill', 0,0, App.screen.width, App.screen.height)
love.graphics.setColor(1,1,1)
love.graphics.printf(Error_message, 40,40, 600)
-- 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
local stack_trace = debug.traceback('Error: '..tostring(err), --[[stack frame]]2):gsub('\n[^\n]+$', '')
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
Mode = 'error'
local stack_trace = debug.traceback('Error: ' .. tostring(err), --[[stack frame]]2):gsub('\n[^\n]+$', '')
local buf
repeat
buf = live.receive_from_driver()
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 "ctrl+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)