From d1de665939c1b99e35d17a2cb6591b46c635bdd2 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 20 Jun 2016 11:46:10 +0200 Subject: [PATCH] Fix a crash in Docker if daemon stop to respond Fix #580 --- gns3server/modules/docker/__init__.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gns3server/modules/docker/__init__.py b/gns3server/modules/docker/__init__.py index c7313840..1c3779a7 100644 --- a/gns3server/modules/docker/__init__.py +++ b/gns3server/modules/docker/__init__.py @@ -101,14 +101,17 @@ class Docker(BaseManager): """ data = json.dumps(data) url = "http://docker/" + path - response = yield from aiohttp.request( - method, - url, - connector=(yield from self.connector()), - params=params, - data=data, - headers={"content-type": "application/json", }, - ) + try: + response = yield from aiohttp.request( + method, + url, + connector=(yield from self.connector()), + params=params, + data=data, + headers={"content-type": "application/json", }, + ) + except aiohttp.ClientResponseError as e: + raise DockerError("Docker has returned an error: {}".format(str(e))) if response.status >= 300: body = yield from response.read() try: