[bot] Refine handling of exceptions in scheduler thread.