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 e8223859d0
commit cac70aded5

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.