Merge "Improve error messages for bootstrap info"

This commit is contained in:
Zuul
2020-02-26 17:54:11 +00:00
committed by Gerrit Code Review
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