Improve error messages for bootstrap info

Change-Id: I727363b794a11a97af08d05e5e7b227a3fa51016
This commit is contained in:
Ian Howell 2020-02-21 09:15:35 -06:00
parent 0501a3b919
commit 090d80ed70
2 changed files with 7 additions and 1 deletions

View File

@ -697,6 +697,12 @@ func (c *Config) CurrentContextBootstrapInfo() (*Bootstrap, error) {
return nil, err
}
if currentCluster.Bootstrap == "" {
return nil, ErrMissingConfig{
What: fmt.Sprintf("No bootstrap-info defined for context %q", c.CurrentContext),
}
}
bootstrap, exists := c.ModulesConfig.BootstrapInfo[currentCluster.Bootstrap]
if !exists {
return nil, ErrBootstrapInfoNotFound{Name: currentCluster.Bootstrap}

View File

@ -57,7 +57,7 @@ type ErrBootstrapInfoNotFound struct {
}
func (e ErrBootstrapInfoNotFound) Error() string {
return fmt.Sprintf("Bootstrap info %s not found", e.Name)
return fmt.Sprintf("Bootstrap info %q not found", e.Name)
}
// ErrWrongConfig returned in case of incorrect configuration