Change error name
This commit is contained in:
parent
77cdacc917
commit
5bce1f4f9d
2 changed files with 6 additions and 6 deletions
|
@ -62,7 +62,7 @@ func (c *client) SendError(cmd *pb.Command, err error) {
|
|||
func (c *client) Talkgroup(ctx context.Context, tg *pb.Talkgroup) error {
|
||||
tgi, err := talkgroups.StoreFrom(ctx).TG(ctx, talkgroups.TG(tg.System, tg.Talkgroup))
|
||||
if err != nil {
|
||||
if err != talkgroups.ErrNoTG {
|
||||
if err != talkgroups.ErrNotFound {
|
||||
log.Error().Err(err).Int32("sys", tg.System).Int32("tg", tg.Talkgroup).Msg("get talkgroup fail")
|
||||
}
|
||||
return err
|
||||
|
|
|
@ -143,7 +143,7 @@ func (t *cache) Load(ctx context.Context, tgs []int64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var ErrNoTG = errors.New("talkgroup not found")
|
||||
var ErrNotFound = errors.New("talkgroup not found")
|
||||
|
||||
func (t *cache) TG(ctx context.Context, tg ID) (Talkgroup, error) {
|
||||
t.RLock()
|
||||
|
@ -158,20 +158,20 @@ func (t *cache) TG(ctx context.Context, tg ID) (Talkgroup, error) {
|
|||
switch err {
|
||||
case nil:
|
||||
case pgx.ErrNoRows:
|
||||
return Talkgroup{}, ErrNoTG
|
||||
return Talkgroup{}, ErrNotFound
|
||||
default:
|
||||
log.Error().Err(err).Msg("TG() cache add db get")
|
||||
return Talkgroup{}, errors.Join(ErrNoTG, err)
|
||||
return Talkgroup{}, errors.Join(ErrNotFound, err)
|
||||
}
|
||||
|
||||
if len(recs) < 1 {
|
||||
return Talkgroup{}, ErrNoTG
|
||||
return Talkgroup{}, ErrNotFound
|
||||
}
|
||||
|
||||
err = t.add(rowToTalkgroup(recs[0]))
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("TG() cache add")
|
||||
return rowToTalkgroup(recs[0]), errors.Join(ErrNoTG, err)
|
||||
return rowToTalkgroup(recs[0]), errors.Join(ErrNotFound, err)
|
||||
}
|
||||
|
||||
return rowToTalkgroup(recs[0]), nil
|
||||
|
|
Loading…
Reference in a new issue