Skip to content

Commit

Permalink
Fix and improve incorrect error messages (#21342)
Browse files Browse the repository at this point in the history
L
  • Loading branch information
delvh authored Oct 6, 2022
1 parent 1294f6c commit b001812
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions modules/options/static.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016 The Gitea Authors. All rights reserved.
// Copyright 2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -32,24 +32,23 @@ func Dir(name string) ([]string, error) {
customDir := path.Join(setting.CustomPath, "options", name)
isDir, err := util.IsDir(customDir)
if err != nil {
return []string{}, fmt.Errorf("Failed to check if custom directory %s is a directory. %v", err)
return []string{}, fmt.Errorf("unable to check if custom directory %q is a directory. %w", customDir, err)
}
if isDir {
files, err := util.StatDir(customDir, true)
if err != nil {
return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
return []string{}, fmt.Errorf("unable to read custom directory %q. %w", customDir, err)
}

result = append(result, files...)
}

files, err := AssetDir(name)
if err != nil {
return []string{}, fmt.Errorf("Failed to read embedded directory. %v", err)
return []string{}, fmt.Errorf("unable to read embedded directory %q. %w", name, err)
}

result = append(result, files...)

return directories.AddAndGet(name, result), nil
}

Expand Down

0 comments on commit b001812

Please sign in to comment.