@@ -7,9 +7,7 @@ package models
77import (
88 "fmt"
99
10- "code.gitea.io/gitea/modules/log"
11-
12- "github.com/go-xorm/builder"
10+ "xorm.io/builder"
1311)
1412
1513// IssueList defines a list of issues
@@ -148,19 +146,17 @@ func (issues IssueList) loadLabels(e Engine) error {
148146 var labelIssue LabelIssue
149147 err = rows .Scan (& labelIssue )
150148 if err != nil {
151- // When there are no rows left and we try to close it, xorm will complain with an error.
152- // Since that is not relevant for us, we can safely ignore it.
153- if err := rows .Close (); err != nil {
154- log .Error ("IssueList.loadLabels: Close: %v" , err )
149+ if err1 := rows .Close (); err1 != nil {
150+ return fmt .Errorf ("IssueList.loadLabels: Close: %v" , err1 )
155151 }
156152 return err
157153 }
158154 issueLabels [labelIssue .IssueLabel .IssueID ] = append (issueLabels [labelIssue .IssueLabel .IssueID ], labelIssue .Label )
159155 }
160- // When there are no rows left and we try to close it, xorm will complain with an error .
156+ // When there are no rows left and we try to close it.
161157 // Since that is not relevant for us, we can safely ignore it.
162- if err := rows .Close (); err != nil {
163- log . Error ("IssueList.loadLabels: Close: %v" , err )
158+ if err1 := rows .Close (); err1 != nil {
159+ return fmt . Errorf ("IssueList.loadLabels: Close: %v" , err1 )
164160 }
165161 left -= limit
166162 issueIDs = issueIDs [limit :]
@@ -241,20 +237,16 @@ func (issues IssueList) loadAssignees(e Engine) error {
241237 var assigneeIssue AssigneeIssue
242238 err = rows .Scan (& assigneeIssue )
243239 if err != nil {
244- // When there are no rows left and we try to close it, xorm will complain with an error.
245- // Since that is not relevant for us, we can safely ignore it.
246- if err := rows .Close (); err != nil {
247- log .Error ("IssueList.loadAssignees: Close: %v" , err )
240+ if err1 := rows .Close (); err1 != nil {
241+ return fmt .Errorf ("IssueList.loadAssignees: Close: %v" , err1 )
248242 }
249243 return err
250244 }
251245
252246 assignees [assigneeIssue .IssueAssignee .IssueID ] = append (assignees [assigneeIssue .IssueAssignee .IssueID ], assigneeIssue .Assignee )
253247 }
254- // When there are no rows left and we try to close it, xorm will complain with an error.
255- // Since that is not relevant for us, we can safely ignore it.
256- if err := rows .Close (); err != nil {
257- log .Error ("IssueList.loadAssignees: Close: %v" , err )
248+ if err1 := rows .Close (); err1 != nil {
249+ return fmt .Errorf ("IssueList.loadAssignees: Close: %v" , err1 )
258250 }
259251 left -= limit
260252 issueIDs = issueIDs [limit :]
@@ -300,19 +292,15 @@ func (issues IssueList) loadPullRequests(e Engine) error {
300292 var pr PullRequest
301293 err = rows .Scan (& pr )
302294 if err != nil {
303- // When there are no rows left and we try to close it, xorm will complain with an error.
304- // Since that is not relevant for us, we can safely ignore it.
305- if err := rows .Close (); err != nil {
306- log .Error ("IssueList.loadPullRequests: Close: %v" , err )
295+ if err1 := rows .Close (); err1 != nil {
296+ return fmt .Errorf ("IssueList.loadPullRequests: Close: %v" , err1 )
307297 }
308298 return err
309299 }
310300 pullRequestMaps [pr .IssueID ] = & pr
311301 }
312- // When there are no rows left and we try to close it, xorm will complain with an error.
313- // Since that is not relevant for us, we can safely ignore it.
314- if err := rows .Close (); err != nil {
315- log .Error ("IssueList.loadPullRequests: Close: %v" , err )
302+ if err1 := rows .Close (); err1 != nil {
303+ return fmt .Errorf ("IssueList.loadPullRequests: Close: %v" , err1 )
316304 }
317305 left -= limit
318306 issuesIDs = issuesIDs [limit :]
@@ -349,19 +337,15 @@ func (issues IssueList) loadAttachments(e Engine) (err error) {
349337 var attachment Attachment
350338 err = rows .Scan (& attachment )
351339 if err != nil {
352- // When there are no rows left and we try to close it, xorm will complain with an error.
353- // Since that is not relevant for us, we can safely ignore it.
354- if err := rows .Close (); err != nil {
355- log .Error ("IssueList.loadAttachments: Close: %v" , err )
340+ if err1 := rows .Close (); err1 != nil {
341+ return fmt .Errorf ("IssueList.loadAttachments: Close: %v" , err1 )
356342 }
357343 return err
358344 }
359345 attachments [attachment .IssueID ] = append (attachments [attachment .IssueID ], & attachment )
360346 }
361- // When there are no rows left and we try to close it, xorm will complain with an error.
362- // Since that is not relevant for us, we can safely ignore it.
363- if err := rows .Close (); err != nil {
364- log .Error ("IssueList.loadAttachments: Close: %v" , err )
347+ if err1 := rows .Close (); err1 != nil {
348+ return fmt .Errorf ("IssueList.loadAttachments: Close: %v" , err1 )
365349 }
366350 left -= limit
367351 issuesIDs = issuesIDs [limit :]
@@ -399,19 +383,15 @@ func (issues IssueList) loadComments(e Engine, cond builder.Cond) (err error) {
399383 var comment Comment
400384 err = rows .Scan (& comment )
401385 if err != nil {
402- // When there are no rows left and we try to close it, xorm will complain with an error.
403- // Since that is not relevant for us, we can safely ignore it.
404- if err := rows .Close (); err != nil {
405- log .Error ("IssueList.loadComments: Close: %v" , err )
386+ if err1 := rows .Close (); err1 != nil {
387+ return fmt .Errorf ("IssueList.loadComments: Close: %v" , err1 )
406388 }
407389 return err
408390 }
409391 comments [comment .IssueID ] = append (comments [comment .IssueID ], & comment )
410392 }
411- // When there are no rows left and we try to close it, xorm will complain with an error.
412- // Since that is not relevant for us, we can safely ignore it.
413- if err := rows .Close (); err != nil {
414- log .Error ("IssueList.loadComments: Close: %v" , err )
393+ if err1 := rows .Close (); err1 != nil {
394+ return fmt .Errorf ("IssueList.loadComments: Close: %v" , err1 )
415395 }
416396 left -= limit
417397 issuesIDs = issuesIDs [limit :]
@@ -461,19 +441,15 @@ func (issues IssueList) loadTotalTrackedTimes(e Engine) (err error) {
461441 var totalTime totalTimesByIssue
462442 err = rows .Scan (& totalTime )
463443 if err != nil {
464- // When there are no rows left and we try to close it, xorm will complain with an error.
465- // Since that is not relevant for us, we can safely ignore it.
466- if err := rows .Close (); err != nil {
467- log .Error ("IssueList.loadTotalTrackedTimes: Close: %v" , err )
444+ if err1 := rows .Close (); err1 != nil {
445+ return fmt .Errorf ("IssueList.loadTotalTrackedTimes: Close: %v" , err1 )
468446 }
469447 return err
470448 }
471449 trackedTimes [totalTime .IssueID ] = totalTime .Time
472450 }
473- // When there are no rows left and we try to close it, xorm will complain with an error.
474- // Since that is not relevant for us, we can safely ignore it.
475- if err := rows .Close (); err != nil {
476- log .Error ("IssueList.loadTotalTrackedTimes: Close: %v" , err )
451+ if err1 := rows .Close (); err1 != nil {
452+ return fmt .Errorf ("IssueList.loadTotalTrackedTimes: Close: %v" , err1 )
477453 }
478454 left -= limit
479455 ids = ids [limit :]
0 commit comments