|
11 | 11 |
|
12 | 12 | from colorama import Fore
|
13 | 13 |
|
14 |
| -from atcodertools.client.atcoder import AtCoderClient, Contest, LoginError |
| 14 | +from atcodertools.client.atcoder import AtCoderClient, Contest, LoginError, PageNotFoundError |
15 | 15 | from atcodertools.client.models.problem import Problem
|
16 | 16 | from atcodertools.client.models.problem_content import InputFormatDetectionError, SampleDetectionError
|
17 | 17 | from atcodertools.codegen.code_style_config import DEFAULT_WORKSPACE_DIR_PATH
|
@@ -169,17 +169,18 @@ def prepare_contest(atcoder_client: AtCoderClient,
|
169 | 169 | retry_max_tries: int = 10):
|
170 | 170 | attempt_count = 1
|
171 | 171 | while True:
|
172 |
| - problem_list = atcoder_client.download_problem_list( |
173 |
| - Contest(contest_id=contest_id)) |
174 |
| - if problem_list: |
| 172 | + try: |
| 173 | + problem_list = atcoder_client.download_problem_list( |
| 174 | + Contest(contest_id=contest_id)) |
175 | 175 | break
|
176 |
| - if 0 < retry_max_tries < attempt_count: |
177 |
| - raise EnvironmentInitializationError |
178 |
| - logger.warning( |
179 |
| - "Failed to fetch. Will retry in {} seconds. (Attempt {})".format(retry_delay_secs, attempt_count)) |
180 |
| - time.sleep(retry_delay_secs) |
181 |
| - retry_delay_secs = min(retry_delay_secs * 2, retry_max_delay_secs) |
182 |
| - attempt_count += 1 |
| 176 | + except PageNotFoundError: |
| 177 | + if 0 < retry_max_tries < attempt_count: |
| 178 | + raise EnvironmentInitializationError |
| 179 | + logger.warning( |
| 180 | + "Failed to fetch. Will retry in {} seconds. (Attempt {})".format(retry_delay_secs, attempt_count)) |
| 181 | + time.sleep(retry_delay_secs) |
| 182 | + retry_delay_secs = min(retry_delay_secs * 2, retry_max_delay_secs) |
| 183 | + attempt_count += 1 |
183 | 184 |
|
184 | 185 | tasks = [(atcoder_client,
|
185 | 186 | problem,
|
|
0 commit comments