mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 16:06:16 -06:00
fix basicDB.Put() to properly process error
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
parent
25af975343
commit
b09f20c838
1 changed files with 1 additions and 5 deletions
|
|
@ -21,7 +21,6 @@ package bundb
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/config"
|
||||
|
|
@ -37,10 +36,7 @@ type basicDB struct {
|
|||
|
||||
func (b *basicDB) Put(ctx context.Context, i interface{}) db.Error {
|
||||
_, err := b.conn.NewInsert().Model(i).Exec(ctx)
|
||||
if err != nil && strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
|
||||
return db.ErrAlreadyExists
|
||||
}
|
||||
return err
|
||||
return b.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
func (b *basicDB) GetByID(ctx context.Context, id string, i interface{}) db.Error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue