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.
LCS2FXROH7ABGKZYVZARAYDVFMLSMVJLUPCKYAWJXRNS437JO2GAC JKTCG7IZRITXKWG3YMAI4VN25JMBQJTEVL4LTORGAU5LTAIW7ELAC BI3BJCRV7UWZFQ4NXVFEGZCDURQGZCL6D3FMP6FODYPBXFZMHJCAC FRGLCNS5RIRMANEDFDW6BCKNY55PTBT2XJYPIV76IIUADPVCCBKAC LBJESGP5OT5MJZRY7OUZRTOIX6G2MAIQLDJB7QBBN3TJOMNS7MAAC SLMZ2H7QMJ5GM3T3MQ2XTROZKYREU2RC54DVQC7Q3CMS7ESQDEBAC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC APX2PY6GAMJSUH7SFSMBFOQJBSAWLLOCKH4L4ZQP2VLHNEXJPREAC KHPSHJN4BMTJ3CHUFQQZU7ZIQDOQDF3L5HV3TRT5OJMYICJAEB5QC NT3LSVTXQAOUA3BSFDGMULGN666CF5T35PXBOK7AFXLD7YKNJTIAC GMDEH4RHOR6DJABQ5WVGY4GVUU3QPWFTPFUHYUOULTVJZA2FTPAQC 2I6URQ573QKGO433M4J7GQOZZLW34BIGMDWDYLAZFTQBWKFW4QBQC RNDKROV3B4W7AAJUB65JGHZZ66OX6KVBGHVWVZGIITBNZH2UE3CAC JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC SSRWGU26CFY43MUCW5QSNDQ375SB472UQZGALRRCRO7FQCFIEQFAC 5WYBV55CRVPFXFA7QXTMFJG3653NGMLYUMNGN2Q7X2Q2XRUWZNFQC 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
if Mode == 'version_check' thenlove.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' thenlove.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 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 terminallocal 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 bufrepeatbuf = live.receive_from_driver()love.timer.sleep(0.001)until bufif buf == 'QUIT' thenreturn 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+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)