Slow exit on exceptions
jgracin opened this issue · 4 comments
Hi!
In view-handlers and input-handlers, processing loops are run within "futures". However, exceptions within futures are not caught anywhere and they cause silent failures. What's more, they cause the editor to quit but with a 60 second delay due to the known shutdown delay of the internal ExecutorService. If one doesn't know what's going on, this appears as if the editor has frozen.
I was thinking of adding an exception handler around the bodies within "future" calls which would do the following
(catch Exception e
(logging/log (with-out-str (stacktrace/print-cause-trace e)))
(editor/force-quit))
I'd probably wrap it in a macro (e.g. exit-on-exception).
What do you think? I can prepare a pull request, if you like.
Hi @jgracin . Yes. Please create a pull request. It will be a great improvement if we can identify causes of "freeze", so we can fix them. Showing the exception and quitting is a good first step. Depending on the exceptions caught we may later allow Liquid to continue running in some of the cases and display the exception in a buffer or log file.
Can't think of a way to automatically check this, but it doesn't seem necessary to me.
Thanks @jgracin :-)
I will apply the patch locally and run with it a couple of days to check how it works out.
Thank you! :-) One way to produce the exception scenario is by starting Liquid with
clj -m dk.salza.liq.core --log=/tmp/liq.log
and pressing C-h h, which will try to open index.md, but since /resources is not included in deps.edn, the editor will throw an exception.