Fix error comparisons

This commit is contained in:
Deluan
2022-09-30 18:54:25 -04:00
parent 7b0a8f47de
commit db67c1277e
27 changed files with 93 additions and 73 deletions
+4 -3
View File
@@ -2,6 +2,7 @@ package persistence
import (
"context"
"errors"
. "github.com/Masterminds/squirrel"
"github.com/beego/beego/v2/client/orm"
@@ -71,7 +72,7 @@ func (r *transcodingRepository) NewInstance() interface{} {
func (r *transcodingRepository) Save(entity interface{}) (string, error) {
t := entity.(*model.Transcoding)
id, err := r.put(t.ID, t)
if err == model.ErrNotFound {
if errors.Is(err, model.ErrNotFound) {
return "", rest.ErrNotFound
}
return id, err
@@ -81,7 +82,7 @@ func (r *transcodingRepository) Update(id string, entity interface{}, cols ...st
t := entity.(*model.Transcoding)
t.ID = id
_, err := r.put(id, t)
if err == model.ErrNotFound {
if errors.Is(err, model.ErrNotFound) {
return rest.ErrNotFound
}
return err
@@ -89,7 +90,7 @@ func (r *transcodingRepository) Update(id string, entity interface{}, cols ...st
func (r *transcodingRepository) Delete(id string) error {
err := r.delete(Eq{"id": id})
if err == model.ErrNotFound {
if errors.Is(err, model.ErrNotFound) {
return rest.ErrNotFound
}
return err