Update error texts (#11022)
Co-authored-by: Daniel Nephin <dnephin@hashicorp.com>
This commit is contained in:
parent
44d91ea56f
commit
27f40ccf51
|
@ -787,7 +787,7 @@ func (b *builder) build() (rt RuntimeConfig, err error) {
|
||||||
return RuntimeConfig{}, fmt.Errorf("config_entries.bootstrap[%d]: %s", i, err)
|
return RuntimeConfig{}, fmt.Errorf("config_entries.bootstrap[%d]: %s", i, err)
|
||||||
}
|
}
|
||||||
if err := entry.Validate(); err != nil {
|
if err := entry.Validate(); err != nil {
|
||||||
return RuntimeConfig{}, fmt.Errorf("config_entries.bootstrap[%d]: %s", i, err)
|
return RuntimeConfig{}, fmt.Errorf("config_entries.bootstrap[%d]: %w", i, err)
|
||||||
}
|
}
|
||||||
configEntries = append(configEntries, entry)
|
configEntries = append(configEntries, entry)
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ func (e *IngressGatewayConfigEntry) Validate() error {
|
||||||
serviceNames := make(map[ServiceID]struct{})
|
serviceNames := make(map[ServiceID]struct{})
|
||||||
for i, s := range listener.Services {
|
for i, s := range listener.Services {
|
||||||
if err := validateInnerEnterpriseMeta(&s.EnterpriseMeta, &e.EnterpriseMeta); err != nil {
|
if err := validateInnerEnterpriseMeta(&s.EnterpriseMeta, &e.EnterpriseMeta); err != nil {
|
||||||
return fmt.Errorf("Services[%d].%v", i, err)
|
return fmt.Errorf("services[%d]: %w", i, err)
|
||||||
}
|
}
|
||||||
sn := NewServiceName(s.Name, &s.EnterpriseMeta)
|
sn := NewServiceName(s.Name, &s.EnterpriseMeta)
|
||||||
if err := s.RequestHeaders.Validate(listener.Protocol); err != nil {
|
if err := s.RequestHeaders.Validate(listener.Protocol); err != nil {
|
||||||
|
@ -401,7 +401,7 @@ func (e *TerminatingGatewayConfigEntry) Validate() error {
|
||||||
cid := NewServiceID(svc.Name, &svc.EnterpriseMeta)
|
cid := NewServiceID(svc.Name, &svc.EnterpriseMeta)
|
||||||
|
|
||||||
if err := validateInnerEnterpriseMeta(&svc.EnterpriseMeta, &e.EnterpriseMeta); err != nil {
|
if err := validateInnerEnterpriseMeta(&svc.EnterpriseMeta, &e.EnterpriseMeta); err != nil {
|
||||||
return fmt.Errorf("Service %q: %v", cid.String(), err)
|
return fmt.Errorf("service %q: %w", cid, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for duplicates within the entry
|
// Check for duplicates within the entry
|
||||||
|
|
|
@ -14,6 +14,6 @@ func RequireErrorContains(t testing.TB, err error, expectedErrorMessage string)
|
||||||
t.Fatal("An error is expected but got nil.")
|
t.Fatal("An error is expected but got nil.")
|
||||||
}
|
}
|
||||||
if !strings.Contains(err.Error(), expectedErrorMessage) {
|
if !strings.Contains(err.Error(), expectedErrorMessage) {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("expected err %v to contain %q", err, expectedErrorMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue