From f2d2b6e7fcd10bf6ea7bcd415dfc0c78fc53b17c Mon Sep 17 00:00:00 2001 From: CaIon Date: Sat, 20 Dec 2025 12:21:53 +0800 Subject: [PATCH] feat(channel): add error handling for SaveWithoutKey when channel ID is 0 --- model/channel.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/model/channel.go b/model/channel.go index a7f741b2..f256b54c 100644 --- a/model/channel.go +++ b/model/channel.go @@ -254,6 +254,9 @@ func (channel *Channel) Save() error { } func (channel *Channel) SaveWithoutKey() error { + if channel.Id == 0 { + return errors.New("channel ID is 0") + } return DB.Omit("key").Save(channel).Error }