Ensure error and stack trace are written to stdout
To address https://github.com/franko/lite-xl/issues/87
This commit is contained in:
parent
199476547b
commit
23a053e1ee
|
@ -879,7 +879,7 @@ function core.on_error(err)
|
||||||
-- write error to file
|
-- write error to file
|
||||||
local fp = io.open(USERDIR .. "/error.txt", "wb")
|
local fp = io.open(USERDIR .. "/error.txt", "wb")
|
||||||
fp:write("Error: " .. tostring(err) .. "\n")
|
fp:write("Error: " .. tostring(err) .. "\n")
|
||||||
fp:write(debug.traceback(nil, 4))
|
fp:write(debug.traceback(nil, 4) .. "\n")
|
||||||
fp:close()
|
fp:close()
|
||||||
-- save copy of all unsaved documents
|
-- save copy of all unsaved documents
|
||||||
for _, doc in ipairs(core.docs) do
|
for _, doc in ipairs(core.docs) do
|
||||||
|
|
|
@ -135,7 +135,8 @@ init_lua:
|
||||||
" core.run()\n"
|
" core.run()\n"
|
||||||
"end, function(err)\n"
|
"end, function(err)\n"
|
||||||
" local error_dir\n"
|
" local error_dir\n"
|
||||||
" print('ERROR', err)\n"
|
" io.stdout:write('Error: '..tostring(err)..'\\n')\n"
|
||||||
|
" io.stdout:write(debug.traceback(nil, 4)..'\\n')\n"
|
||||||
" if core and core.on_error then\n"
|
" if core and core.on_error then\n"
|
||||||
" error_dir=USERDIR\n"
|
" error_dir=USERDIR\n"
|
||||||
" pcall(core.on_error, err)\n"
|
" pcall(core.on_error, err)\n"
|
||||||
|
@ -143,7 +144,7 @@ init_lua:
|
||||||
" error_dir=system.absolute_path('.')\n"
|
" error_dir=system.absolute_path('.')\n"
|
||||||
" local fp = io.open('error.txt', 'wb')\n"
|
" local fp = io.open('error.txt', 'wb')\n"
|
||||||
" fp:write('Error: ' .. tostring(err) .. '\\n')\n"
|
" fp:write('Error: ' .. tostring(err) .. '\\n')\n"
|
||||||
" fp:write(debug.traceback(nil, 4))\n"
|
" fp:write(debug.traceback(nil, 4)..'\\n')\n"
|
||||||
" fp:close()\n"
|
" fp:close()\n"
|
||||||
" end\n"
|
" end\n"
|
||||||
" system.show_fatal_error('Lite XL internal error',\n"
|
" system.show_fatal_error('Lite XL internal error',\n"
|
||||||
|
|
Loading…
Reference in New Issue