Skip to content

Commit 401cd1b

Browse files
committed
Raise RuntimeError when first-chunk callback runs without a task
Replace the assert with a RuntimeError to match the codebase's idiomatic handling of programmer errors, per PR review feedback. Signed-off-by: Stephen Crowe <6042774+crowecawcaw@users.noreply.github.com>
1 parent 62927b7 commit 401cd1b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

s3transfer/download.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,10 +661,10 @@ def __init__(
661661
self._task = None
662662

663663
def __call__(self):
664-
# Always check if we have a task and response first
665-
assert self._task is not None, (
666-
"set_task() must be called before the task is submitted"
667-
)
664+
if self._task is None:
665+
raise RuntimeError(
666+
"set_task() must be called before the task is submitted"
667+
)
668668

669669
response = self._task.get_response()
670670
if not response:

0 commit comments

Comments
 (0)