handle error

This commit is contained in:
Kenneth Kehl
2024-01-31 08:06:09 -08:00
parent 363ecb33d5
commit 277262ed69

View File

@@ -120,6 +120,10 @@ def extract_phones(job):
phone_index = phone_index + 1
current_app.logger.info(f"PHONE INDEX IS NOW {phone_index}")
current_app.logger.info(f"LENGTH OF ROW IS {len(row)}")
if phone_index <= len(row):
phones[job_row] = "Error: can't retrieve phone number"
current_app.logger.error("Corrupt csv file, missing columns job_id {job_id} service_id {service_id}")
else:
my_phone = row[phone_index]
my_phone = re.sub(r"[\+\s\(\)\-\.]*", "", my_phone)
phones[job_row] = my_phone