diff options
author | 2023-06-04 18:55:30 +0200 | |
---|---|---|
committer | 2023-06-04 18:55:30 +0200 | |
commit | 97bc2e713a6e5b2c25869b93f5232560d7110170 (patch) | |
tree | 62d76de2c489331413cd2d53a99e0daeb762efaa /internal/timeline/get.go | |
parent | [docs] Add Repology stats (#1859) (diff) | |
download | gotosocial-97bc2e713a6e5b2c25869b93f5232560d7110170.tar.xz |
[chore] tidy + test timelines a bit better (#1865)
* [chore] tidy + test timelines a bit better
* thanks linter
Diffstat (limited to 'internal/timeline/get.go')
-rw-r--r-- | internal/timeline/get.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/timeline/get.go b/internal/timeline/get.go index a93e2d1ed..bc238c276 100644 --- a/internal/timeline/get.go +++ b/internal/timeline/get.go @@ -21,11 +21,11 @@ import ( "container/list" "context" "errors" - "fmt" "time" "codeberg.org/gruf/go-kv" "github.com/superseriousbusiness/gotosocial/internal/db" + "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/log" ) @@ -147,7 +147,7 @@ func (t *timeline) Get(ctx context.Context, amount int, maxID string, sinceID st } default: - err = errors.New("Get: switch statement exhausted with no results") + err = gtserror.New("switch statement exhausted with no results") } return items, err @@ -255,7 +255,8 @@ func (t *timeline) getXBetweenIDs(ctx context.Context, amount int, behindID stri return true, nil } // We've got a proper db error. - return false, fmt.Errorf("getXBetweenIDs: db error while trying to prepare %s: %w", entry.itemID, err) + err = gtserror.Newf("db error while trying to prepare %s: %w", entry.itemID, err) + return false, err } entry.prepared = prepared } @@ -349,7 +350,8 @@ func (t *timeline) getXBetweenIDs(ctx context.Context, amount int, behindID stri continue } // We've got a proper db error. - return nil, fmt.Errorf("getXBetweenIDs: db error while trying to prepare %s: %w", entry.itemID, err) + err = gtserror.Newf("db error while trying to prepare %s: %w", entry.itemID, err) + return nil, err } entry.prepared = prepared } @@ -396,7 +398,7 @@ func (t *timeline) prepareNextQuery(amount int, maxID string, sinceID string, mi case maxID == "" && minID != "": err = t.prepareXBetweenIDs(ctx, amount, id.Highest, minID, false) default: - err = errors.New("Get: switch statement exhausted with no results") + err = gtserror.New("switch statement exhausted with no results") } if err != nil { |