make seperate error commands depending on if a channel or a command already exists

This commit is contained in:
lyx0 2022-08-11 01:50:30 +02:00
parent 350283018e
commit 88b114a826
3 changed files with 6 additions and 5 deletions

View file

@ -69,7 +69,7 @@ func (c ChannelModel) Insert(channel *Channel) error {
}
if rowsAffected == 0 {
return ErrRecordAlreadyExists
return ErrChannelRecordAlreadyExists
}
return nil

View file

@ -66,7 +66,7 @@ func (c CommandModel) Insert(name, text string) error {
}
if rowsAffected == 0 {
return ErrRecordAlreadyExists
return ErrCommandRecordAlreadyExists
}
return nil

View file

@ -6,9 +6,10 @@ import (
)
var (
ErrRecordNotFound = errors.New("record not found")
ErrRecordAlreadyExists = errors.New("channel already in database")
ErrUserAlreadyExists = errors.New("user already in database")
ErrRecordNotFound = errors.New("record not found")
ErrChannelRecordAlreadyExists = errors.New("channel already in database")
ErrCommandRecordAlreadyExists = errors.New("command already exists")
ErrUserAlreadyExists = errors.New("user already in database")
)
// struct Models wraps the models, making them callable