1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-24 08:28:49 +02:00

Add try/catch in Google Sheets scripts

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-04-06 21:57:34 +02:00
parent c45071c038
commit 0f5d0c8b40
2 changed files with 17 additions and 4 deletions

View File

@ -40,7 +40,17 @@ class Command(BaseCommand):
for pool in pools.all():
if options['verbosity'] >= 1:
self.stdout.write(f"Parsing notation sheet for pool {pool.short_name} for {tournament}")
pool.parse_spreadsheet()
sleep(3) # Three calls = 3s sleep
try:
pool.parse_spreadsheet()
except Exception as e:
if options['verbosity'] >= 1:
self.stderr.write(
self.style.ERROR(f"Error while parsing pool {pool.short_name} for {tournament.name}: {e}"))
finally:
sleep(3) # Three calls = 3s sleep
tournament.parse_tweaks_spreadsheets()
try:
tournament.parse_tweaks_spreadsheets()
except Exception as e:
if options['verbosity'] >= 1:
self.stderr.write(self.style.ERROR(f"Error while parsing tweaks for {tournament.name}: {e}"))