fix(接口测试): 优化导入接口时的报错提示

--bug=1010779 --user=宋天阳
【接口测试】接口列表导入接口自动化的数据,报错
https://www.tapd.cn/55049933/s/1113276
This commit is contained in:
song-tianyang 2022-03-03 17:13:55 +08:00 committed by CountryBuilder
parent 7132d3ff3e
commit 6735f22213
1 changed files with 28 additions and 23 deletions

View File

@ -1148,6 +1148,7 @@ public class ApiDefinitionService {
noticeSendService.send(NoticeConstants.TaskType.SWAGGER_TASK, noticeModel); noticeSendService.send(NoticeConstants.TaskType.SWAGGER_TASK, noticeModel);
} }
} }
try {
importApi(request, apiImport); importApi(request, apiImport);
if (CollectionUtils.isNotEmpty(apiImport.getData())) { if (CollectionUtils.isNotEmpty(apiImport.getData())) {
List<String> names = apiImport.getData().stream().map(ApiDefinitionWithBLOBs::getName).collect(Collectors.toList()); List<String> names = apiImport.getData().stream().map(ApiDefinitionWithBLOBs::getName).collect(Collectors.toList());
@ -1172,6 +1173,10 @@ public class ApiDefinitionService {
.build(); .build();
noticeSendService.send(NoticeConstants.Mode.SCHEDULE, "", noticeModel); noticeSendService.send(NoticeConstants.Mode.SCHEDULE, "", noticeModel);
} }
}catch (Exception e){
LogUtil.error(e);
MSException.throwException(Translator.get("user_import_format_wrong"));
}
return apiImport; return apiImport;
} }