try-except in main loop