Parcourir la source

fix: Handle error in NotifyRootUser and log system errors #812

1808837298@qq.com il y a 1 an
Parent
commit
a3739f67f7
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      service/user_notify.go

+ 4 - 1
service/user_notify.go

@@ -11,7 +11,10 @@ import (
 
 
 func NotifyRootUser(t string, subject string, content string) {
 func NotifyRootUser(t string, subject string, content string) {
 	user := model.GetRootUser().ToBaseUser()
 	user := model.GetRootUser().ToBaseUser()
-	_ = NotifyUser(user.Id, user.Email, user.GetSetting(), dto.NewNotify(t, subject, content, nil))
+	err := NotifyUser(user.Id, user.Email, user.GetSetting(), dto.NewNotify(t, subject, content, nil))
+	if err != nil {
+		common.SysError(fmt.Sprintf("failed to notify root user: %s", err.Error()))
+	}
 }
 }
 
 
 func NotifyUser(userId int, userEmail string, userSetting map[string]interface{}, data dto.Notify) error {
 func NotifyUser(userId int, userEmail string, userSetting map[string]interface{}, data dto.Notify) error {