diff --git a/frontend/src/business/components/api/automation/api-automation.js b/frontend/src/business/components/api/automation/api-automation.js index 36a33ee048..b729b5e0ba 100644 --- a/frontend/src/business/components/api/automation/api-automation.js +++ b/frontend/src/business/components/api/automation/api-automation.js @@ -99,8 +99,8 @@ export function saveScenario(url, scenario, scenarioDefinition, _this, success) success(response); } }, error => { - _this.$emit('errorRefresh', {}); - }); + _this.$emit('errorRefresh', error); + },true); } export function editApiScenarioCaseOrder(request, callback) { diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 7bc0484a17..3f83d27b68 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -1501,7 +1501,10 @@ export default { this.initMessageSocket(); } }, - errorRefresh() { + errorRefresh(error) { + if (error && (error + "").indexOf("code 400") !== -1) { + this.$warning("步骤内容解析失败,检查是否有已经移除的插件步骤。") + } this.debug = false; this.isTop = false; this.debugLoading = false; diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue index 42493fd495..9369b646b5 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiResponseComponent.vue @@ -36,7 +36,6 @@ export default { this.getExecResult(); } else { this.response = this.result; - // this.isActive = true; } if(this.apiActive){ this.isActive = false @@ -62,10 +61,14 @@ export default { let url = "/api/definition/report/getReport/" + this.apiItem.id; this.$get(url, response => { if (response.data) { - let data = JSON.parse(response.data.content); - this.response = data; - this.$set(this.apiItem, 'responseData', data); - this.isActive = true; + try { + let data = JSON.parse(response.data.content); + this.response = data; + this.$set(this.apiItem, 'responseData', data); + this.isActive = true; + }catch (error){ + this.isActive = true; + } } }); } diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 0a27aa4e33..6d05542d39 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -502,9 +502,13 @@ export default { let url = "/api/definition/report/get/" + apiCase.lastResultId; this.$get(url, response => { if (response.data) { - let data = JSON.parse(response.data.content); - this.response = data; - this.resVisible = true; + try { + let data = JSON.parse(response.data.content); + this.response = data; + this.resVisible = true; + } catch (error) { + this.resVisible = true; + } } }); } @@ -653,9 +657,9 @@ export default { } else if (this.selectDataRange != null) { let selectParamArr = this.selectDataRange.split(":"); if (selectParamArr.length === 2) { - if(selectParamArr[0] === "single") { + if (selectParamArr[0] === "single") { this.condition.id = selectParamArr[1]; - }else { + } else { this.condition.apiDefinitionId = selectParamArr[1]; } } diff --git a/frontend/src/business/components/task/TaskCenter.vue b/frontend/src/business/components/task/TaskCenter.vue index 5692e6dbf0..1db7e06d85 100644 --- a/frontend/src/business/components/task/TaskCenter.vue +++ b/frontend/src/business/components/task/TaskCenter.vue @@ -360,9 +360,13 @@ export default { let url = "/api/definition/report/get/" + reportId; this.$get(url, response => { if (response.data) { - let data = JSON.parse(response.data.content); - this.response = data; - this.visible = true; + try { + let data = JSON.parse(response.data.content); + this.response = data; + this.visible = true; + } catch (error) { + this.visible = true; + } } }); } diff --git a/frontend/src/common/js/ajax.js b/frontend/src/common/js/ajax.js index 837b015905..05a39f8abe 100644 --- a/frontend/src/common/js/ajax.js +++ b/frontend/src/common/js/ajax.js @@ -107,7 +107,7 @@ export function post(url, data, success, failure) { } } -export function request(axiosRequestConfig, success, failure) { +export function request(axiosRequestConfig, success, failure, hideError) { let result = {loading: true}; if (!success) { return axios.request(axiosRequestConfig); @@ -115,7 +115,9 @@ export function request(axiosRequestConfig, success, failure) { axios.request(axiosRequestConfig).then(response => { then(success, response, result); }).catch(error => { - exception(error, result); + if (!hideError) { + exception(error, result); + } if (failure) { then(failure, error, result); }