chore(tasks): add more details to error message
Some checks failed
continuous-integration/drone/push Build is failing

Trying to debug https://vikunja.sentry.io/share/issue/ef81451b0c7b43f1bff2d3a86ba393bb/
This commit is contained in:
kolaente 2024-09-29 21:04:19 +02:00
parent 5478acfc09
commit 1fe5e9cc55
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -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
}