From 03151eaa3e46d35437a6205e2139a9dfa21a0300 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 12 Mar 2021 15:56:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B1=E4=BA=8Enode-controller=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/docker/DockerTestEngine.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java index 2e357a04d0..e7f6fa41e3 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java @@ -103,12 +103,18 @@ public class DockerTestEngine extends AbstractEngine { startTestRequest.setEnv(env); String uri = String.format(BASE_URL + "/jmeter/container/start", nodeIp, port); - ResultHolder result = restTemplate.postForObject(uri, startTestRequest, ResultHolder.class); - if (result == null) { - MSException.throwException(Translator.get("start_engine_fail")); - } - if (!result.isSuccess()) { - MSException.throwException(result.getMessage()); + try { + ResultHolder result = restTemplate.postForObject(uri, startTestRequest, ResultHolder.class); + if (result == null) { + MSException.throwException(Translator.get("start_engine_fail")); + } + if (!result.isSuccess()) { + MSException.throwException(result.getMessage()); + } + } catch (MSException e) { + throw e; + } catch (Exception e) { + MSException.throwException("Please check node-controller status."); } }