fix(数据源): 报错信息国际化

This commit is contained in:
taojinlong 2022-09-01 17:07:07 +08:00
parent 7df17c6706
commit bee455407a
4 changed files with 15 additions and 6 deletions

View File

@ -289,13 +289,13 @@ public class DatasourceService {
return ResultHolder.success(datasourceDTO);
}
if (success > 0 && success < apiDefinitionList.size()) {
return ResultHolder.error("Datasource has invalid tables", datasourceDTO);
return ResultHolder.error(Translator.get("I18N_DS_INVALID_TABLE") , datasourceDTO);
}
return ResultHolder.error("Datasource is invalid.", datasourceDTO);
return ResultHolder.error(Translator.get("I18N_DS_INVALID") , datasourceDTO);
}
return ResultHolder.success(datasourceDTO);
} catch (Exception e) {
return ResultHolder.error("Datasource is invalid: " + e.getMessage());
return ResultHolder.error(Translator.get("I18N_DS_INVALID"), e.getMessage());
}
}
@ -327,15 +327,15 @@ public class DatasourceService {
return ResultHolder.success(datasource);
}
if (success > 0 && success < apiDefinitionList.size()) {
return ResultHolder.error("Datasource has invalid tables", datasource);
return ResultHolder.error(Translator.get("I18N_DS_INVALID_TABLE"), datasource);
}
return ResultHolder.error("Datasource is invalid.", datasource);
return ResultHolder.error(Translator.get("I18N_DS_INVALID"), datasource);
}
return ResultHolder.success("Success");
} catch (Exception e) {
datasourceStatus = "Error";
return ResultHolder.error("Datasource is invalid: " + e.getMessage());
return ResultHolder.error(Translator.get("I18N_DS_INVALID"), e.getMessage());
} finally {
Datasource record = new Datasource();
record.setStatus(datasourceStatus);

View File

@ -218,3 +218,6 @@ I18N_SYNC_LOG=Sync log
I18N_USER_DONOT_EXIST=User do not exist
I18N_USER_SOURCE_PWD_ERROR=Source password error
I18N_USER_PWD_FORMAT_ERROR=Password format error
I18N_DS_INVALID=Datasource is invalid.
I18N_DS_INVALID_TABLE=Datasource has invalid tables

View File

@ -218,3 +218,6 @@ I18N_SYNC_LOG=\u540C\u6B65\u65E5\u5FD7
I18N_USER_DONOT_EXIST=\u7528\u6237\u4E0D\u5B58\u5728
I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u7801\u9519\u8BEF
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u7801\u683C\u5F0F\u9519\u8BEF
I18N_DS_INVALID=数据源无效.
I18N_DS_INVALID_TABLE=数据源中有无效的表

View File

@ -214,3 +214,6 @@ I18N_SYNC_LOG=\u540C\u6B65\u65E5\u8A8C
I18N_USER_DONOT_EXIST=\u7528\u6236\u4E0D\u5B58\u5728
I18N_USER_SOURCE_PWD_ERROR=\u539F\u59CB\u5BC6\u78BC\u932F\u8AA4
I18N_USER_PWD_FORMAT_ERROR=\u5BC6\u78BC\u683C\u5F0F\u932F\u8AA4
I18N_DS_INVALID=數據源無效.
I18N_DS_INVALID_TABLE=數據源中有無效的表