mirror of
https://github.com/coaidev/coai.git
synced 2025-05-21 05:50:14 +09:00
chore: update mysql connection error message and logger style
This commit is contained in:
parent
84485eae16
commit
fea7442b85
@ -62,6 +62,7 @@
|
||||
overflow-y: auto;
|
||||
touch-action: pan-y;
|
||||
padding: 0.5rem;
|
||||
white-space: pre-wrap !important;
|
||||
}
|
||||
|
||||
.console-icon {
|
||||
|
@ -29,11 +29,11 @@ func ConnectMySQL() *sql.DB {
|
||||
viper.GetInt("mysql.port"),
|
||||
viper.GetString("mysql.db"),
|
||||
))
|
||||
if err != nil || db.Ping() != nil {
|
||||
if pingErr := db.Ping(); err != nil || pingErr != nil {
|
||||
errMsg := utils.Multi[string](err != nil, utils.GetError(err), utils.GetError(pingErr)) // err.Error() may contain nil pointer
|
||||
globals.Warn(
|
||||
fmt.Sprintf("[connection] failed to connect to mysql server: %s (message: %s), will retry in 5 seconds",
|
||||
viper.GetString("mysql.host"),
|
||||
utils.GetError(err), // err.Error() may contain nil pointer
|
||||
viper.GetString("mysql.host"), errMsg,
|
||||
),
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user