I have written a "small" python service that grew too much, and from time to time, some exceptions happen (generally in a thread, or inside an async function). The main program keeps working, but not working right.
I am aware that the proper thing to do is to find where the exceptions happen (mostly caused by irregular data) and try to catch these exceptions, but I am in the middle of another project, and just don't have the time for it.
Is there a simple way, like, maybe an argument in python that closes the program when any exception occurs? Or perhaps a systemctl way to restart when an error occurs? (I have the Restart=always
on my service file, but as I mentioned, the main program is working fine).
Thank you.