diff options
author | 2020-10-02 14:12:47 -0400 | |
---|---|---|
committer | 2020-10-02 14:12:47 -0400 | |
commit | e423fbee442e89a93846dd801b0d2786d72e27bd (patch) | |
tree | d5341e80bed6ed1c82fffaee6c578c97d7a90f5e /init.lua | |
parent | 375d0e6b94781156a76682d39b89db507b5d24cd (diff) |
Handle startup errors more nicely.
This also prevents a crash on exit in some circumstances, due to mismatched
metatables.
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -321,7 +321,13 @@ buffer.accessibility = buffer.ACCESSIBILITY_DISABLED -- Load user init file, which may also define default buffer settings. local user_init = _USERHOME .. '/init.lua' -if lfs.attributes(user_init) then dofile(user_init) end +if lfs.attributes(user_init) then + local ok, errmsg = pcall(dofile, user_init) + if not ok then + events.connect( + events.INITIALIZED, function() events.emit(events.ERROR, errmsg) end) + end +end -- Generate default buffer settings for subsequent buffers and remove temporary -- buffer metatable listener. |