diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index 663d8d5aa4..60ec6ed8b6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -198,12 +198,17 @@ public class ApiAutomationController { @PostMapping(value = "/run/debug") @MsAuditLog(module = OperLogModule.API_AUTOMATION, type = OperLogConstants.DEBUG, title = "#request.scenarioName", sourceId = "#request.scenarioId", project = "#request.projectId") - public void runDebug(@RequestPart("request") RunDefinitionRequest request, - @RequestPart(value = "bodyFiles", required = false) List bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List scenarioFiles) { - if (StringUtils.isEmpty(request.getExecuteType())) { - request.setExecuteType(ExecuteType.Debug.name()); + public String runDebug(@RequestPart("request") RunDefinitionRequest request, + @RequestPart(value = "bodyFiles", required = false) List bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List scenarioFiles) { + try { + if (StringUtils.isEmpty(request.getExecuteType())) { + request.setExecuteType(ExecuteType.Debug.name()); + } + apiAutomationService.debugRun(request, bodyFiles, scenarioFiles); + } catch (Exception e) { + return e.getMessage(); } - apiAutomationService.debugRun(request, bodyFiles, scenarioFiles); + return "SUCCESS"; } @PostMapping(value = "/run") diff --git a/frontend/src/business/components/api/automation/scenario/DebugRun.vue b/frontend/src/business/components/api/automation/scenario/DebugRun.vue index afa343cffe..24d7314060 100644 --- a/frontend/src/business/components/api/automation/scenario/DebugRun.vue +++ b/frontend/src/business/components/api/automation/scenario/DebugRun.vue @@ -26,7 +26,6 @@ export default { return { result: {}, loading: false, - runId: "", reqNumber: 0, } }, @@ -87,7 +86,10 @@ export default { url = '/ui/automation/run/debug'; } saveScenario(url, reqObj, this.runData.hashTree, this, (response) => { - this.runId = response.data; + if(response.data !== "SUCCESS"){ + this.$error(response.data ? response.data : this.$t('commons.run_fail')); + this.$emit('errorRefresh'); + } }); }, }