Skip to content

Commit ee87c4d

Browse files
committed
chore: handle error details in stream response
1 parent db7f8b8 commit ee87c4d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docker/api/image.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,11 @@ def push(self, repository, tag=None, stream=False, auth_config=None,
495495
self._raise_for_status(response)
496496

497497
if stream:
498-
return self._stream_helper(response, decode=decode)
498+
for line in self._stream_helper(response, decode=decode):
499+
if isinstance(line, dict) and "errorDetail" in line:
500+
raise errors.APIError(line["errorDetail"]["message"])
501+
yield line
502+
499503

500504
return self._result(response)
501505

0 commit comments

Comments
 (0)