Merge branch 'ai_0.3_install_api' into 'test'

feat: modify the error information about the failure to create a table

See merge request opensource/answer!226
This commit is contained in:
linkinstar 2022-11-11 04:20:38 +00:00
commit 25763d20ff
3 changed files with 4 additions and 1 deletions

View File

@ -97,6 +97,8 @@ backend:
database:
connection_failed:
other: "Database connection failed"
create_table_failed:
other: "Create table failed"
install:
create_config_failed:
other: "Cant create the config.yaml file."

View File

@ -40,6 +40,7 @@ const (
ReportNotFound = "error.report.not_found"
ReadConfigFailed = "error.config.read_config_failed"
DatabaseConnectionFailed = "error.database.connection_failed"
InstallCreateTableFailed = "error.database.create_table_failed"
InstallConfigFailed = "error.install.create_config_failed"
SiteInfoNotFound = "error.site_info.not_found"
)

View File

@ -170,7 +170,7 @@ func InitBaseInfo(ctx *gin.Context) {
if err := migrations.InitDB(c.Data.Database); err != nil {
log.Error("init database error: ", err.Error())
handler.HandleResponse(ctx, errors.BadRequest(reason.DatabaseConnectionFailed), schema.ErrTypeAlert)
handler.HandleResponse(ctx, errors.BadRequest(reason.InstallCreateTableFailed), schema.ErrTypeAlert)
return
}