I'm creating a selenium bot using python and have to use multithreading to speed up the process of getting my information scraped from different menus for different restaurants. I have a couple threads running, scraping the menus but ocassionally a thread will crash, failing to get the menu for that restaurant. The goal is to return the thread number that crashed, so that I can try again running a thread on that restaurant.
I have a simple start, that will initiate the threads and a join that will make sure to only continue once all threads are done. Is there a way to catch an exception and for the child thread to return its identity back to the main thread?
# Start
for t in threads:
t.start()
# Join
for t in threads:
t.join()