Improve error on router without service.

Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
Ludovic Fernandez 2019-07-19 16:42:04 +02:00 committed by Traefiker Bot
parent c39a550b00
commit 1800b0b69c
13 changed files with 125 additions and 40 deletions

View file

@ -35,8 +35,9 @@ func (m *Manager) BuildTCP(rootCtx context.Context, serviceName string) (tcp.Han
return nil, fmt.Errorf("the service %q does not exist", serviceQualifiedName)
}
if conf.LoadBalancer == nil {
conf.Err = fmt.Errorf("the service %q doesn't have any TCP load balancer", serviceQualifiedName)
return nil, conf.Err
err := fmt.Errorf("the service %q doesn't have any TCP load balancer", serviceQualifiedName)
conf.AddError(err, true)
return nil, err
}
logger := log.FromContext(ctx)