@@ -626,9 +626,14 @@ func SearchRepo(ctx *context.Context) {
626
626
if ctx .FormBool ("count_only" ) {
627
627
count , err := repo_model .CountRepository (ctx , opts )
628
628
if err != nil {
629
+ log .Error ("CountRepository: %v" , err )
630
+ errStr := "CountRepository internal error"
631
+ if ctx .Doer != nil && ctx .Doer .IsAdmin {
632
+ errStr += ": " + err .Error ()
633
+ }
629
634
ctx .JSON (http .StatusInternalServerError , api.SearchError {
630
635
OK : false ,
631
- Error : err . Error () ,
636
+ Error : errStr ,
632
637
})
633
638
return
634
639
}
@@ -638,9 +643,14 @@ func SearchRepo(ctx *context.Context) {
638
643
639
644
repos , count , err := repo_model .SearchRepository (ctx , opts )
640
645
if err != nil {
646
+ log .Error ("SearchRepository: %v" , err )
647
+ errStr := "SearchRepository internal error"
648
+ if ctx .Doer != nil && ctx .Doer .IsAdmin {
649
+ errStr += ": " + err .Error ()
650
+ }
641
651
ctx .JSON (http .StatusInternalServerError , api.SearchError {
642
652
OK : false ,
643
- Error : err . Error () ,
653
+ Error : errStr ,
644
654
})
645
655
return
646
656
}
@@ -650,6 +660,14 @@ func SearchRepo(ctx *context.Context) {
650
660
latestCommitStatuses , err := commitstatus_service .FindReposLastestCommitStatuses (ctx , repos )
651
661
if err != nil {
652
662
log .Error ("FindReposLastestCommitStatuses: %v" , err )
663
+ errStr := "FindReposLastestCommitStatuses internal error"
664
+ if ctx .Doer != nil && ctx .Doer .IsAdmin {
665
+ errStr += ": " + err .Error ()
666
+ }
667
+ ctx .JSON (http .StatusInternalServerError , api.SearchError {
668
+ OK : false ,
669
+ Error : errStr ,
670
+ })
653
671
return
654
672
}
655
673
0 commit comments