Log error before retry

This commit is contained in:
James Jennett-Wheeler 2025-06-25 15:01:28 +01:00
parent acaa93cf47
commit 34008046b2

View File

@ -46,8 +46,10 @@ def update_other_applications():
min(search_past_week + search_num_weeks, 9)): # Council only allow latest 9 weeks
try:
weekly_list.scrape(_browser, search_week_idx)
except Exception:
# try one more time
except Exception as e:
print(f'Error found: {repr(e)}')
print(traceback.format_exc())
print("Try again")
weekly_list.scrape(_browser, search_week_idx)
there_were_newly_decided_applications = len(weekly_list.new_applications) > 0
@ -66,8 +68,10 @@ def update_other_applications():
_app = Application(_cursor, application_ref)
try:
_app.scrape_portal(_browser)
except Exception:
# try one more time
except Exception as e:
print(f'Error found: {repr(e)}')
print(traceback.format_exc())
print("Try again")
_app.scrape_portal(_browser)
if _app.caseOfficer == "Christopher Masters":
@ -95,8 +99,10 @@ if __name__ == '__main__':
with webdriver.Chrome(options=web_opts) as browser:
try:
application.scrape_portal(browser, force=True, count_documents=True)
except Exception:
# try one more time
except Exception as e:
print(f'Error found: {repr(e)}')
print(traceback.format_exc())
print("Try again")
application.scrape_portal(browser, force=True, count_documents=True)
if application.new_documents_found: