mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
make seperate error commands depending on if a channel or a command already exists
This commit is contained in:
parent
350283018e
commit
88b114a826
|
@ -69,7 +69,7 @@ func (c ChannelModel) Insert(channel *Channel) error {
|
|||
}
|
||||
|
||||
if rowsAffected == 0 {
|
||||
return ErrRecordAlreadyExists
|
||||
return ErrChannelRecordAlreadyExists
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -66,7 +66,7 @@ func (c CommandModel) Insert(name, text string) error {
|
|||
}
|
||||
|
||||
if rowsAffected == 0 {
|
||||
return ErrRecordAlreadyExists
|
||||
return ErrCommandRecordAlreadyExists
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue