Skip to content

Commit f8161c9

Browse files
committed
use custom exception to avoid collisions
1 parent 4bf7a71 commit f8161c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tool/run.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ class DifferentAnswersException(Exception):
2121
pass
2222

2323

24+
class TooLongException(Exception):
25+
pass
26+
27+
2428
class UnexpectedDebugLinesException(Exception):
2529
pass
2630

2731
def maxDurationHandler(signum, frame):
28-
raise Exception("Too long")
32+
raise TooLongException("Too long")
2933

3034
signal.signal(signal.SIGALRM, maxDurationHandler)
3135

@@ -80,7 +84,7 @@ def run(
8084
previous = result
8185
except (DifferentAnswersException, UnexpectedDebugLinesException) as e:
8286
errors.append(f"{BColor.RED}ERROR: {e}{BColor.ENDC}")
83-
except Exception:
87+
except TooLongException:
8488
errors.append(f"{BColor.RED}[{submission.author}] day-{submission.problem.day}/part-{submission.problem.part} ({submission.language}){BColor.ENDC}: Maximum of {max_duration}s reached (on input {BColor.BLUE}{input.author}{BColor.ENDC})")
8589

8690
for submission in submissions:

0 commit comments

Comments
 (0)