summaryrefslogtreecommitdiff
path: root/docker/clientbase.py
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2015-07-16 15:10:07 -0400
committerLars Kellogg-Stedman <lars@redhat.com>2015-07-17 08:31:54 -0400
commit2e546f7e26fec006dd18119d4857580ec9ccd540 (patch)
tree7fc92cce86583dd16827eb0019d6ff56be53c2fd /docker/clientbase.py
parent946eb964adceef7f531ca4f30c4bfe973566811a (diff)
downloaddocker-py-2e546f7e26fec006dd18119d4857580ec9ccd540.tar.gz
return NotFound on 404 errors
This changes raises docker.errors.NotFound on 404 errors. This gives client code the ability to differentiate between "an image does not exist" and "you are using the api incorrectly". This inherits from docker.errors.APIError so it will not affect any existing code.
Diffstat (limited to 'docker/clientbase.py')
-rw-r--r--docker/clientbase.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/docker/clientbase.py b/docker/clientbase.py
index c81ee0c..ce52ffa 100644
--- a/docker/clientbase.py
+++ b/docker/clientbase.py
@@ -99,6 +99,8 @@ class ClientBase(requests.Session):
try:
response.raise_for_status()
except requests.exceptions.HTTPError as e:
+ if e.response.status_code == 404:
+ raise errors.NotFound(e, response, explanation=explanation)
raise errors.APIError(e, response, explanation=explanation)
def _result(self, response, json=False, binary=False):