summaryrefslogtreecommitdiff
path: root/internal/oauth/pgclientstore.go
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-03-17 16:01:31 +0100
committerLibravatar tsmethurst <tobi.smethurst@klarrio.com>2021-03-17 16:01:31 +0100
commit6eab00e05e6e65a2b8fc738ae25be5fa6c5283b3 (patch)
treefb71e4a2ce47ec7c4695fac0cb365c4a569fd80e /internal/oauth/pgclientstore.go
parentfiddling (diff)
downloadgotosocial-6eab00e05e6e65a2b8fc738ae25be5fa6c5283b3.tar.xz
getting there.......
Diffstat (limited to 'internal/oauth/pgclientstore.go')
-rw-r--r--internal/oauth/pgclientstore.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/oauth/pgclientstore.go b/internal/oauth/pgclientstore.go
index 22bb54f55..1df46fedb 100644
--- a/internal/oauth/pgclientstore.go
+++ b/internal/oauth/pgclientstore.go
@@ -20,6 +20,7 @@ package oauth
import (
"context"
+ "fmt"
"github.com/go-pg/pg/v10"
"github.com/gotosocial/oauth2/v4"
@@ -42,7 +43,7 @@ func (pcs *pgClientStore) GetByID(ctx context.Context, clientID string) (oauth2.
ID: clientID,
}
if err := pcs.conn.WithContext(ctx).Model(poc).Where("id = ?", poc.ID).Select(); err != nil {
- return nil, err
+ return nil, fmt.Errorf("error in clientstore getbyid searching for client %s: %s", clientID, err)
}
return models.New(poc.ID, poc.Secret, poc.Domain, poc.UserID), nil
}
@@ -55,7 +56,10 @@ func (pcs *pgClientStore) Set(ctx context.Context, id string, cli oauth2.ClientI
UserID: cli.GetUserID(),
}
_, err := pcs.conn.WithContext(ctx).Model(poc).OnConflict("(id) DO UPDATE").Insert()
- return err
+ if err != nil {
+ return fmt.Errorf("error in clientstore set: %s", err)
+ }
+ return nil
}
func (pcs *pgClientStore) Delete(ctx context.Context, id string) error {
@@ -63,7 +67,10 @@ func (pcs *pgClientStore) Delete(ctx context.Context, id string) error {
ID: id,
}
_, err := pcs.conn.WithContext(ctx).Model(poc).Where("id = ?", poc.ID).Delete()
- return err
+ if err != nil {
+ return fmt.Errorf("error in clientstore delete: %s", err)
+ }
+ return nil
}
type oauthClient struct {