add logs for updating database failed

This commit is contained in:
RockYang
2024-05-21 11:55:38 +08:00
parent a6de958daa
commit 5253d657b6
17 changed files with 41 additions and 7 deletions

View File

@@ -261,6 +261,7 @@ func (h *ChatHandler) RemoveMessage(c *gin.Context) {
id := h.GetInt(c, "id", 0)
tx := h.DB.Unscoped().Where("id = ?", id).Delete(&model.ChatMessage{})
if tx.Error != nil {
logger.Error("error with update database", tx.Error)
resp.ERROR(c, "更新数据库失败!")
return
}