Skip to content

Commit

Permalink
Merge pull request #82 from murpii/mt-log-submission-state-errors
Browse files Browse the repository at this point in the history
MT: Log submission errors
  • Loading branch information
def- authored Feb 19, 2024
2 parents 1aaceb6 + ca131aa commit 16c12f3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cogs/map_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ async def ddnet_delete(self, filename: str):
async def upload_submission(self, subm: Submission):
try:
await self.ddnet_upload('map', await subm.buffer(), str(subm))
except RuntimeError:
except RuntimeError as e:
log.error(f'RuntimeError: {e}')
await subm.set_state(SubmissionState.ERROR)
else:
await subm.set_state(SubmissionState.UPLOADED)
Expand All @@ -146,6 +147,7 @@ async def validate_submission(self, isubm: InitialSubmission):
if released:
raise ValueError('A map with that name is already released')
except ValueError as exc:
log.error(f'RuntimeError: {exc}')
await isubm.respond(exc)
await isubm.set_state(SubmissionState.ERROR)
else:
Expand Down Expand Up @@ -250,7 +252,8 @@ async def handle_submission_approve(self, payload: discord.RawReactionActionEven
isubm = InitialSubmission(message)
try:
isubm.validate()
except ValueError:
except ValueError as e:
log.error(f'ValueError: {e}')
return

self._active_submissions.add(message.id)
Expand Down Expand Up @@ -343,7 +346,8 @@ async def archive_testlog(self, testlog: TestLog) -> bool:

try:
await self.ddnet_upload('log', BytesIO(js.encode('utf-8')), testlog.name)
except RuntimeError:
except RuntimeError as e:
log.error(f'RuntimeError: {e}')
failed = True

for asset_type, assets in testlog.assets.items():
Expand All @@ -361,7 +365,8 @@ async def archive_testlog(self, testlog: TestLog) -> bool:

try:
await self.ddnet_upload(asset_type, BytesIO(bytes_), filename)
except RuntimeError:
except RuntimeError as e:
log.error(f'RuntimeError: {e}')
failed = True
continue

Expand Down

0 comments on commit 16c12f3

Please sign in to comment.