Skip to content

Commit 2f44af9

Browse files
committed
Log repository unit loading error
1 parent 81ad114 commit 2f44af9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

models/repo.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ func (repo *Repository) getUnitsByUserID(e Engine, userID int64, isAdmin bool) (
383383

384384
// UnitEnabled if this repository has the given unit enabled
385385
func (repo *Repository) UnitEnabled(tp UnitType) bool {
386-
repo.getUnits(x)
386+
if err := repo.getUnits(x); err != nil {
387+
log.Warn("Error loading repository (ID: %d) units: %s", repo.ID, err.Error())
388+
}
387389
for _, unit := range repo.Units {
388390
if unit.Type == tp {
389391
return true
@@ -394,7 +396,9 @@ func (repo *Repository) UnitEnabled(tp UnitType) bool {
394396

395397
// AnyUnitEnabled if this repository has the any of the given units enabled
396398
func (repo *Repository) AnyUnitEnabled(tps ...UnitType) bool {
397-
repo.getUnits(x)
399+
if err := repo.getUnits(x); err != nil {
400+
log.Warn("Error loading repository (ID: %d) units: %s", repo.ID, err.Error())
401+
}
398402
for _, unit := range repo.Units {
399403
for _, tp := range tps {
400404
if unit.Type == tp {

modules/templates/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ var trNLangRules = map[string]func(int64) int{
375375
},
376376
}
377377

378-
// TrN returns key to be used for translation depending on count
378+
// TrN returns key to be used for plural text translation
379379
func TrN(lang string, cnt interface{}, key1, keyN string) string {
380380
var c int64
381381
if t, ok := cnt.(int); ok {

0 commit comments

Comments
 (0)