diff --git a/backend/framework/sdk/src/main/resources/i18n/api.properties b/backend/framework/sdk/src/main/resources/i18n/api.properties index 5047ca49ad..2109e962ca 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api.properties @@ -274,3 +274,8 @@ api_debug_module.project_id.length_range=项目ID长度必须在1-50之间 api_debug_module.pos.not_blank=模块位置不能为空 api_debug_module.name.not_contain_slash=模块名称不能包含斜杠 +#module: ApiEnvironmentConfig +api_environment_config.id.not_blank=ID不能为空 +api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 +api_environment_config.environment_id.not_blank=环境ID不能为空 +api_module.not.exist=模块不存在 diff --git a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties index 9dde4e28e8..a00785f297 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties @@ -279,4 +279,5 @@ api_debug_module.unplanned_request=Unplanned request #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能为空 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 -api_environment_config.environment_id.not_blank=环境ID不能为空 \ No newline at end of file +api_environment_config.environment_id.not_blank=环境ID不能为空 +api_module.not.exist=模块不存在 \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties index b704c82baa..191a6f6a81 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties @@ -279,4 +279,5 @@ api_debug_module.unplanned_request=未规划请求 #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能为空 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 -api_environment_config.environment_id.not_blank=环境ID不能为空 \ No newline at end of file +api_environment_config.environment_id.not_blank=环境ID不能为空 +api_module.not.exist=模块不存在 \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties index 212d86bb71..c31af51ca3 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties @@ -279,4 +279,5 @@ api_debug_module.unplanned_request=未規劃請求 #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能為空 api_environment_config.environment_id.length_range=環境ID長度必須在1-50之間 -api_environment_config.environment_id.not_blank=環境ID不能為空 \ No newline at end of file +api_environment_config.environment_id.not_blank=環境ID不能為空 +api_module.not.exist=模塊不存在 \ No newline at end of file diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java index b4ca615598..7abfa7a80c 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java @@ -36,6 +36,7 @@ import java.util.stream.Collectors; @Transactional(rollbackFor = Exception.class) public class ApiDebugModuleService extends ModuleTreeService { private static final String UNPLANNED = "api_debug_module.unplanned_request"; + private static final String MODULE_NO_EXIST = "api_module.not.exist"; private static final String METHOD = "method"; private static final String DEBUG_MODULE_COUNT_ALL = "all"; @Resource @@ -151,7 +152,7 @@ public class ApiDebugModuleService extends ModuleTreeService { public void update(DebugModuleUpdateRequest request, String userId, String projectId) { ApiDebugModule module = apiDebugModuleMapper.selectByPrimaryKey(request.getId()); if (module == null) { - throw new MSException("file_module.not.exist"); + throw new MSException(Translator.get(MODULE_NO_EXIST)); } ApiDebugModule updateModule = new ApiDebugModule(); updateModule.setId(request.getId()); @@ -209,7 +210,7 @@ public class ApiDebugModuleService extends ModuleTreeService { ApiDebugModule dragNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDragNodeId()); if (dragNode == null) { - throw new MSException("file_module.not.exist:" + request.getDragNodeId()); + throw new MSException(Translator.get(MODULE_NO_EXIST) + ": " + request.getDragNodeId()); } else { module = new BaseModule(dragNode.getId(), dragNode.getName(), dragNode.getPos(), dragNode.getProjectId(), dragNode.getParentId()); } @@ -221,7 +222,7 @@ public class ApiDebugModuleService extends ModuleTreeService { ApiDebugModule dropNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDropNodeId()); if (dropNode == null) { - throw new MSException("file_module.not.exist:" + request.getDropNodeId()); + throw new MSException(Translator.get(MODULE_NO_EXIST) + ": " + request.getDropNodeId()); } if (request.getDropPosition() == 0) {