aboutsummaryrefslogtreecommitdiffstats
path: root/repository/gogit_config.go
diff options
context:
space:
mode:
authorSteve Moyer <smoyer1@selesy.com>2022-11-27 20:51:37 -0500
committerSteve Moyer <smoyer1@selesy.com>2022-11-27 20:51:37 -0500
commit64c18b15a4a0c8b7e59587aa09de92d52c698ede (patch)
tree8738e651e57c3cf7a21ae76e9733206ccea7a6b9 /repository/gogit_config.go
parentc6bb6b9c7ecddb679966b1561e2e909a9ee5e8cd (diff)
downloadgit-bug-64c18b15a4a0c8b7e59587aa09de92d52c698ede.tar.gz
feat: wrap ErrNoConfigEntry to report missing key
Resolves #935.
Diffstat (limited to 'repository/gogit_config.go')
-rw-r--r--repository/gogit_config.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/repository/gogit_config.go b/repository/gogit_config.go
index 891e3ffb..87141e9d 100644
--- a/repository/gogit_config.go
+++ b/repository/gogit_config.go
@@ -119,7 +119,7 @@ func (cr *goGitConfigReader) ReadString(key string) (string, error) {
sectionName := split[0]
if !cfg.Raw.HasSection(sectionName) {
- return "", ErrNoConfigEntry
+ return "", fmt.Errorf("%w: missing key %s", ErrNoConfigEntry, key)
}
section := cfg.Raw.Section(sectionName)
@@ -127,7 +127,7 @@ func (cr *goGitConfigReader) ReadString(key string) (string, error) {
case len(split) == 2:
optionName := split[1]
if !section.HasOption(optionName) {
- return "", ErrNoConfigEntry
+ return "", fmt.Errorf("%w: missing key %s", ErrNoConfigEntry, key)
}
if len(section.OptionAll(optionName)) > 1 {
return "", ErrMultipleConfigEntry
@@ -137,11 +137,11 @@ func (cr *goGitConfigReader) ReadString(key string) (string, error) {
subsectionName := strings.Join(split[1:len(split)-1], ".")
optionName := split[len(split)-1]
if !section.HasSubsection(subsectionName) {
- return "", ErrNoConfigEntry
+ return "", fmt.Errorf("%w: missing key %s", ErrNoConfigEntry, key)
}
subsection := section.Subsection(subsectionName)
if !subsection.HasOption(optionName) {
- return "", ErrNoConfigEntry
+ return "", fmt.Errorf("%w: missing key %s", ErrNoConfigEntry, key)
}
if len(subsection.OptionAll(optionName)) > 1 {
return "", ErrMultipleConfigEntry