From 29d51d99c4ed4eb47cfd7a9cd1900c670dd6ffa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helgi=20=C3=9Eormar=20=C3=9Eorbj=C3=B6rnsson?= Date: Sat, 10 Sep 2016 15:06:52 -0700 Subject: [PATCH] fix(scheduler): show more information when there is a HTTP error in Kubernetes (#1041) --- rootfs/scheduler/exceptions.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rootfs/scheduler/exceptions.py b/rootfs/scheduler/exceptions.py index 399819d24..e939277e8 100644 --- a/rootfs/scheduler/exceptions.py +++ b/rootfs/scheduler/exceptions.py @@ -7,10 +7,14 @@ class KubeHTTPException(KubeException): def __init__(self, response, errmsg, *args, **kwargs): self.response = response + data = response.json() + message = data['message'] if 'message' in data else '' + msg = errmsg.format(*args) - msg = "failed to {}: {} {}".format( + msg = 'failed to {}: {} {} {}'.format( msg, response.status_code, - response.reason + response.reason, + message ) KubeException.__init__(self, msg, *args, **kwargs)