From 504785e7e80fd3d895c568539538c98ef05a7563 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 2 Jul 2020 11:51:48 +0200 Subject: [PATCH] Add more logs of api exception --- .../bubble/service/cloud/StandardNetworkService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java b/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java index 1bcf3fda..c689ab2b 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java +++ b/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java @@ -48,6 +48,7 @@ import org.cobbzilla.util.io.TempDir; import org.cobbzilla.util.system.Command; import org.cobbzilla.util.system.CommandResult; import org.cobbzilla.util.system.CommandShell; +import org.cobbzilla.wizard.api.ApiException; import org.cobbzilla.wizard.cache.redis.RedisService; import org.cobbzilla.wizard.validation.MultiViolationException; import org.cobbzilla.wizard.validation.SimpleViolationException; @@ -352,6 +353,7 @@ public class StandardNetworkService implements NetworkService { // wait for node to be ready final long readyStart = now(); boolean ready = false; + Exception lastEx = null; BubbleNodeClient nodeClient = null; while (now() - readyStart < NODE_READY_TIMEOUT) { sleep(SECONDS.toMillis(2), "newNode: waiting for node ("+node.id()+") to be ready"); @@ -365,9 +367,18 @@ public class StandardNetworkService implements NetworkService { } } catch (Exception e) { log.warn("newNode: node ("+node.id()+") error checking if ready: "+shortError(e)); + lastEx = e; } } if (!ready) { + if (lastEx != null) { + var responseStatus = ""; + if (lastEx instanceof ApiException) { + responseStatus = " (HTTP status: " + + String.valueOf(((ApiException) lastEx).getResponse().status) + ")"; + } + log.warn("newNode: the last exception in checking if ready" + responseStatus, lastEx); + } return die("newNode: timeout waiting for node ("+node.id()+") to be ready"); }