mirror of https://gitee.com/answerdev/answer.git
feat: modify the error information about the failure to create a table
This commit is contained in:
parent
0c4eeda383
commit
e00a03f2dd
|
@ -32,13 +32,12 @@ var (
|
|||
// @in header
|
||||
// @name Authorization
|
||||
func main() {
|
||||
log.SetLogger(zap.NewLogger(
|
||||
log.ParseLevel(logLevel), zap.WithName("answer"), zap.WithPath(logPath), zap.WithCallerFullPath()))
|
||||
Execute()
|
||||
}
|
||||
|
||||
func runApp() {
|
||||
log.SetLogger(zap.NewLogger(
|
||||
log.ParseLevel(logLevel), zap.WithName("answer"), zap.WithPath(logPath), zap.WithCallerFullPath()))
|
||||
|
||||
c, err := conf.ReadConfig(cli.GetConfigFilePath())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
|
@ -97,6 +97,8 @@ backend:
|
|||
database:
|
||||
connection_failed:
|
||||
other: "Database connection failed"
|
||||
create_table_failed:
|
||||
other: "Create table failed"
|
||||
install:
|
||||
create_config_failed:
|
||||
other: "Can’t create the config.yaml 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"
|
||||
)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue