-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathcontrol_flow.py
More file actions
28 lines (19 loc) · 1.17 KB
/
Copy pathcontrol_flow.py
File metadata and controls
28 lines (19 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class StopCodemodException(Exception):
"""Raises when the codemod execution should stop early.
This gets caught upstream and causes an early exit so that we can surface a subset of the results to the user for faster iteration.
"""
threshold: int | None = None
def __init__(self, message: str | None = None, threshold: int | None = None):
super().__init__(message)
self.threshold = threshold
class MaxTransactionsExceeded(StopCodemodException):
"""Raised when the number of transactions exceeds the max_transactions limit.
This gets caught upstream and causes an early exit so that we can surface a subset of the results to the user for faster iteration.
"""
class MaxPreviewTimeExceeded(StopCodemodException):
"""Raised when more than the allotted time has passed for previewing transactions. Enables us to keep it at like ~5s in the frontend during debugging"""
class MaxAIRequestsError(StopCodemodException):
"""Raised when the number of AI requests exceeds the max_ai_requests limit.
This gets caught upstream and causes an early exit so that we can surface a subset of the
results to the user for faster iteration.
"""