Save timeout errors to log

master
Dan Howe 6 years ago
parent 3f342b05d0
commit 7f363c3601

@ -51,8 +51,12 @@ def wait_for_element(driver, by, x, timeout=180):
Raises Raises
TimeoutException if element does not load within timeout period TimeoutException if element does not load within timeout period
""" """
try:
element_present = EC.presence_of_element_located((by, x)) element_present = EC.presence_of_element_located((by, x))
WebDriverWait(driver, timeout).until(element_present) WebDriverWait(driver, timeout).until(element_present)
except TimeoutError:
raise TimeoutError(
'Request timed out on {}. Try again later?'.format(bore_id))
def get_telemetered_bore(driver, bore_id, start_date, end_date): def get_telemetered_bore(driver, bore_id, start_date, end_date):
@ -214,7 +218,7 @@ def telemetered_bore_downloader(bore_ids, start_date, end_date, download_dir):
pbar.set_description(bore_id) pbar.set_description(bore_id)
try: try:
get_telemetered_bore(driver, bore_id, start_date, end_date) get_telemetered_bore(driver, bore_id, start_date, end_date)
except ValueError as e: except (ValueError, TimeoutError) as e:
logging.error(e) logging.error(e)
# Tidy up console after tqdm # Tidy up console after tqdm

Loading…
Cancel
Save