diff options
| author | Joffrey F <joffrey@docker.com> | 2016-09-19 18:03:01 -0700 |
|---|---|---|
| committer | Joffrey F <joffrey@docker.com> | 2016-09-19 18:03:01 -0700 |
| commit | 6b7a828400f46ea81374bc5764d8aa81bf38f6f7 (patch) | |
| tree | cd39f0039e64fcfa759c64ee1fb7f18f5e9dce5b | |
| parent | 803ff5030e1977e49bca7feea02d74afeabd6356 (diff) | |
| download | docker-py-1222-diagnostic.tar.gz | |
Raise DockerException when encountering non-JSON chunk in stream_helper1222-diagnostic
Signed-off-by: Joffrey F <joffrey@docker.com>
| -rw-r--r-- | docker/client.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/docker/client.py b/docker/client.py index 47ad09e..c013849 100644 --- a/docker/client.py +++ b/docker/client.py @@ -256,7 +256,12 @@ class Client( data_list = data.split("\r\n") # load and yield each line seperately for data in data_list: - data = json.loads(data) + try: + data = json.loads(data) + except Exception: + raise errors.DockerException( + '"{0}" is not valid JSON.' + ) yield data else: yield data |
