summaryrefslogtreecommitdiffstats
path: root/modules/options
diff options
context:
space:
mode:
authordelvh <dev.lh@web.de>2022-10-06 08:00:54 +0200
committerGitHub <noreply@github.com>2022-10-06 07:00:54 +0100
commitb001812df41fcf86f17a90f9fead2c27bf544e63 (patch)
tree481ce9e70d81340e46ecf2d2cf5ce8453a6cac28 /modules/options
parent1294f6c511d0aca4608ba80a38f2d06f980c341a (diff)
downloadgitea-b001812df41fcf86f17a90f9fead2c27bf544e63.tar.gz
gitea-b001812df41fcf86f17a90f9fead2c27bf544e63.zip
Fix and improve incorrect error messages (#21342)
L
Diffstat (limited to 'modules/options')
-rw-r--r--modules/options/static.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/options/static.go b/modules/options/static.go
index d9a6c83664..4d60879be3 100644
--- a/modules/options/static.go
+++ b/modules/options/static.go
@@ -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.
@@ -32,12 +32,12 @@ 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...)
@@ -45,11 +45,10 @@ func Dir(name string) ([]string, error) {
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
}