@@ -7,9 +7,7 @@ package models
7
7
import (
8
8
"fmt"
9
9
10
- "code.gitea.io/gitea/modules/log"
11
-
12
- "github.com/go-xorm/builder"
10
+ "xorm.io/builder"
13
11
)
14
12
15
13
// IssueList defines a list of issues
@@ -148,19 +146,17 @@ func (issues IssueList) loadLabels(e Engine) error {
148
146
var labelIssue LabelIssue
149
147
err = rows .Scan (& labelIssue )
150
148
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 )
155
151
}
156
152
return err
157
153
}
158
154
issueLabels [labelIssue .IssueLabel .IssueID ] = append (issueLabels [labelIssue .IssueLabel .IssueID ], labelIssue .Label )
159
155
}
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.
161
157
// 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 )
164
160
}
165
161
left -= limit
166
162
issueIDs = issueIDs [limit :]
@@ -241,20 +237,16 @@ func (issues IssueList) loadAssignees(e Engine) error {
241
237
var assigneeIssue AssigneeIssue
242
238
err = rows .Scan (& assigneeIssue )
243
239
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 )
248
242
}
249
243
return err
250
244
}
251
245
252
246
assignees [assigneeIssue .IssueAssignee .IssueID ] = append (assignees [assigneeIssue .IssueAssignee .IssueID ], assigneeIssue .Assignee )
253
247
}
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 )
258
250
}
259
251
left -= limit
260
252
issueIDs = issueIDs [limit :]
@@ -300,19 +292,15 @@ func (issues IssueList) loadPullRequests(e Engine) error {
300
292
var pr PullRequest
301
293
err = rows .Scan (& pr )
302
294
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 )
307
297
}
308
298
return err
309
299
}
310
300
pullRequestMaps [pr .IssueID ] = & pr
311
301
}
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 )
316
304
}
317
305
left -= limit
318
306
issuesIDs = issuesIDs [limit :]
@@ -349,19 +337,15 @@ func (issues IssueList) loadAttachments(e Engine) (err error) {
349
337
var attachment Attachment
350
338
err = rows .Scan (& attachment )
351
339
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 )
356
342
}
357
343
return err
358
344
}
359
345
attachments [attachment .IssueID ] = append (attachments [attachment .IssueID ], & attachment )
360
346
}
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 )
365
349
}
366
350
left -= limit
367
351
issuesIDs = issuesIDs [limit :]
@@ -399,19 +383,15 @@ func (issues IssueList) loadComments(e Engine, cond builder.Cond) (err error) {
399
383
var comment Comment
400
384
err = rows .Scan (& comment )
401
385
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 )
406
388
}
407
389
return err
408
390
}
409
391
comments [comment .IssueID ] = append (comments [comment .IssueID ], & comment )
410
392
}
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 )
415
395
}
416
396
left -= limit
417
397
issuesIDs = issuesIDs [limit :]
@@ -461,19 +441,15 @@ func (issues IssueList) loadTotalTrackedTimes(e Engine) (err error) {
461
441
var totalTime totalTimesByIssue
462
442
err = rows .Scan (& totalTime )
463
443
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 )
468
446
}
469
447
return err
470
448
}
471
449
trackedTimes [totalTime .IssueID ] = totalTime .Time
472
450
}
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 )
477
453
}
478
454
left -= limit
479
455
ids = ids [limit :]
0 commit comments