How to ExitApp on Exception?

Get help with using AutoHotkey and its commands and hotkeys
hobboy
Posts: 41
Joined: 05 Jan 2016, 09:59

How to ExitApp on Exception?

10 Sep 2017, 21:36

When using hotkeys or other functionality that enables #Persistent, unhandled Exceptions cause the current thread to exit rather than ExitApp. It is incredibly rare that I would be able to recover the program after an unhandled Exception, so instead of exiting the thread I would like to ExitApp. Otherwise the user has a zombie programming running that really should have closed when it failed.

Is it possible to ExitApp on an unhandled Exception? I created this fork of AHK_L to get the required functionality, but it might be a little over the top (and buggy).

I'm not a fan of wrapping my entire programs in try/catch/finally statements either. But if that's how it's meant to be done I can look into it.
hobboy
Posts: 41
Joined: 05 Jan 2016, 09:59

Re: How to ExitApp on Exception?

10 Sep 2017, 21:51

Maybe I should simply wrap my program in a try/catch/finally statement since I also do logging
https://stackoverflow.com/questions/273 ... -try-catch

edit: on further thought this might not catch other threads from hotkeys. I've looked at Only catch errors causing the script to exit but I need to think about whether this would work for me.

Return to “Ask For Help”

Who is online

Users browsing this forum: Chunjee, Leviy, swagfag and 224 guests