Skip to content

Commit 4cfb157

Browse files
committed
Merge pull request #676 from larsks/feature/notfound-on-404
return NotFound on 404 errors
2 parents 946eb96 + 2e546f7 commit 4cfb157

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docker/clientbase.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def _raise_for_status(self, response, explanation=None):
9999
try:
100100
response.raise_for_status()
101101
except requests.exceptions.HTTPError as e:
102+
if e.response.status_code == 404:
103+
raise errors.NotFound(e, response, explanation=explanation)
102104
raise errors.APIError(e, response, explanation=explanation)
103105

104106
def _result(self, response, json=False, binary=False):

docker/errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ class DockerException(Exception):
5353
pass
5454

5555

56+
class NotFound(APIError):
57+
pass
58+
59+
5660
class InvalidVersion(DockerException):
5761
pass
5862

0 commit comments

Comments
 (0)