Skip to content

Commit cf15667

Browse files
committed
fix(docker client): default to generic message on exceptions
There was a scenario where the message variable would not get populated and cause a python exception that was not handled
1 parent 8b49d66 commit cf15667

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rootfs/registry/dockerclient.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ def log_output(stream, operation, repo, tag):
142142

143143
def stream_error(chunk, operation, repo, tag):
144144
"""Translate docker stream errors into a more digestable format"""
145+
# grab the generic error and strip the useless Error: portion
146+
message = chunk['error'].replace('Error: ', '')
147+
145148
# not all errors provide the code
146149
if 'code' in chunk['errorDetail']:
147150
# permission denied on the repo
148151
if chunk['errorDetail']['code'] == 403:
149152
message = 'Permission Denied attempting to {} image {}:{}'.format(operation, repo, tag)
150-
else:
151-
# grab the generic error and strip the useless Error: portion
152-
message = chunk['error'].replace('Error: ', '')
153153

154154
raise RegistryException(message)
155155

0 commit comments

Comments
 (0)