print err when recording request

This commit is contained in:
2023-07-11 15:21:55 +08:00
parent 8889da73ab
commit 26520bc899

View File

@@ -1,6 +1,8 @@
package main package main
import ( import (
"log"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gorm.io/gorm" "gorm.io/gorm"
) )
@@ -15,5 +17,8 @@ func recordUserMessage(c *gin.Context, db *gorm.DB, body []byte) {
requestRecord := RequestRecord{ requestRecord := RequestRecord{
Body: bodyStr, Body: bodyStr,
} }
db.Create(&requestRecord) err := db.Create(&requestRecord).Error
if err != nil {
log.Println("Error record request:", err)
}
} }