Commit f2d2b6e7 by CaIon

feat(channel): add error handling for SaveWithoutKey when channel ID is 0

parent 7a9cfa38
...@@ -254,6 +254,9 @@ func (channel *Channel) Save() error { ...@@ -254,6 +254,9 @@ func (channel *Channel) Save() error {
} }
func (channel *Channel) SaveWithoutKey() error { func (channel *Channel) SaveWithoutKey() error {
if channel.Id == 0 {
return errors.New("channel ID is 0")
}
return DB.Omit("key").Save(channel).Error return DB.Omit("key").Save(channel).Error
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment