Modified the previous commit using Erros.New() function
parent
061b159991
commit
8b2289836a
|
@ -104,7 +104,11 @@ var serviceCmd = &cobra.Command{
|
|||
|
||||
urls, err := service.WaitForService(api, namespace, svc, serviceURLTemplate, serviceURLMode, https, wait, interval)
|
||||
if err != nil {
|
||||
exit.WithCodeT(exit.Data, `Error opening service: {{.error}}`, out.V{"error": err})
|
||||
if err.Error() == "Service not found in namespace" {
|
||||
exit.WithCodeT(exit.Data, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
|
||||
You may select another namespace by using 'minikube service {{.service}} -n <namespace>'. Or list out all the services using 'minikube service list'`, out.V{"service": svc, "namespace": namespace})
|
||||
}
|
||||
exit.WithError("Error opening service", err)
|
||||
}
|
||||
|
||||
openURLs(svc, urls)
|
||||
|
|
|
@ -276,8 +276,7 @@ func WaitForService(api libmachine.API, namespace string, service string, urlTem
|
|||
chkSVC := func() error { return CheckService(namespace, service) }
|
||||
|
||||
if err := retry.Expo(chkSVC, time.Duration(interval)*time.Second, time.Duration(wait)*time.Second); err != nil {
|
||||
return urlList, errors.Errorf(`Service %s was not found in %q namespace.
|
||||
You may select another namespace by using 'minikube service %s -n <namespace>'. Or list out all the services using 'minikube service list'`, service, namespace, service)
|
||||
return nil, errors.New("Service not found in namespace")
|
||||
}
|
||||
|
||||
serviceURL, err := GetServiceURLsForService(api, namespace, service, urlTemplate)
|
||||
|
|
Loading…
Reference in New Issue