From 1fe5e9cc5534cba1282fd214ad7217c3396612ae Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 29 Sep 2024 21:04:19 +0200 Subject: [PATCH] chore(tasks): add more details to error message Trying to debug https://vikunja.sentry.io/share/issue/ef81451b0c7b43f1bff2d3a86ba393bb/ --- pkg/models/task_search.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/models/task_search.go b/pkg/models/task_search.go index f9c75ad99..631549e1a 100644 --- a/pkg/models/task_search.go +++ b/pkg/models/task_search.go @@ -18,6 +18,7 @@ package models import ( "context" + "fmt" "strconv" "strings" "time" @@ -300,7 +301,7 @@ func (d *dbTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task, totalCo OrderBy(orderby). Find(&tasks) if err != nil { - return nil, totalCount, err + return nil, totalCount, fmt.Errorf("could not fetch tasks: %w", err) } // fetch subtasks when expanding @@ -363,6 +364,10 @@ func (d *dbTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task, totalCo totalCount, err = queryCount. Select("count(DISTINCT tasks.id)"). Count(&Task{}) + if err != nil { + sql, vals := queryCount.LastSQL() + return nil, 0, fmt.Errorf("could not fetch task count, error was '%w', sql: '%v', vaues: %v", err, sql, vals) + } return }