Make the error message that comes from parsing the config file more

useful.

Fixes #2080
This commit is contained in:
Jeff Mitchell 2018-03-19 19:40:51 -04:00
parent c3569011b7
commit 735efccd6e
1 changed files with 6 additions and 1 deletions

View File

@ -64,7 +64,12 @@ func LoadConfig(path string) (*DefaultConfig, error) {
return nil, err
}
return ParseConfig(string(contents))
conf, err := ParseConfig(string(contents))
if err != nil {
return nil, fmt.Errorf("Error parsing config file at %s: %q. Ensure that the file is valid; Ansible Vault is known to conflict with it.", path, err)
}
return conf, nil
}
// ParseConfig parses the given configuration as a string.