remove out.FatalT()

pull/17965/head
Predrag Rogic 2024-01-30 23:33:22 +00:00
parent d818fc6cd0
commit 6ab09e03e0
No known key found for this signature in database
GPG Key ID: F1FF5748C4855229
5 changed files with 7 additions and 14 deletions

View File

@ -541,14 +541,14 @@ func handleSingleDeletionError(err error) {
if ok {
switch deletionError.Errtype {
case Fatal:
out.FatalT("Failed to delete profile(s): {{.error}}", out.V{"error": deletionError.Error()})
out.ErrT(style.Fatal, "Failed to delete profile(s): {{.error}}", out.V{"error": deletionError.Error()})
os.Exit(reason.ExGuestError)
case MissingProfile:
out.ErrT(style.Sad, deletionError.Error())
case MissingCluster:
out.ErrT(style.Meh, deletionError.Error())
default:
out.FatalT("Unable to delete profile(s): {{.error}}", out.V{"error": deletionError.Error()})
out.ErrT(style.Fatal, "Unable to delete profile(s): {{.error}}", out.V{"error": deletionError.Error()})
os.Exit(reason.ExGuestError)
}
} else {

View File

@ -51,7 +51,7 @@ var nodeStopCmd = &cobra.Command{
err = machine.StopHost(api, machineName)
if err != nil {
out.FatalT("Failed to stop node {{.name}}: {{.error}}", out.V{"name": name, "error": err})
out.ErrT(style.Fatal, "Failed to stop node {{.name}}: {{.error}}", out.V{"name": name, "error": err})
os.Exit(reason.ExHostError)
}
out.Step(style.Stopped, "Successfully stopped node {{.name}}", out.V{"name": machineName})

View File

@ -98,8 +98,7 @@ var serviceCmd = &cobra.Command{
var services service.URLs
services, err := service.GetServiceURLs(co.API, co.Config.Name, namespace, serviceURLTemplate)
if err != nil {
out.FatalT("Failed to get service URL: {{.error}}", out.V{"error": err})
out.ErrT(style.Notice, "Check that minikube is running and that you have specified the correct namespace (-n flag) if required.")
out.ErrT(style.Fatal, "Failed to get service URL - check that minikube is running and that you have specified the correct namespace (-n flag) if required: {{.error}}", out.V{"error": err})
os.Exit(reason.ExSvcUnavailable)
}

View File

@ -47,8 +47,7 @@ var serviceListCmd = &cobra.Command{
serviceURLs, err := service.GetServiceURLs(co.API, co.Config.Name, serviceListNamespace, serviceURLTemplate)
if err != nil {
out.FatalT("Failed to get service URL: {{.error}}", out.V{"error": err})
out.ErrT(style.Notice, "Check that minikube is running and that you have specified the correct namespace (-n flag) if required.")
out.ErrT(style.Fatal, "Failed to get service URL - check that minikube is running and that you have specified the correct namespace (-n flag) if required: {{.error}}", out.V{"error": err})
os.Exit(reason.ExSvcUnavailable)
}
serviceURLs = updatePortsAndURLs(serviceURLs, co)

View File

@ -255,11 +255,6 @@ func SuccessT(format string, a ...V) {
Step(style.Success, format, a...)
}
// FatalT does Not Exit - it is only a shortcut for writing a templated fatal message to stderr.
func FatalT(format string, a ...V) {
ErrT(style.Fatal, format, a...)
}
// WarningT is a shortcut for writing a templated warning message to stderr
func WarningT(format string, a ...V) {
if JSON {
@ -368,12 +363,12 @@ func LogEntries(msg string, err error, entries map[string][]string) {
func displayError(msg string, err error) {
klog.Warningf(fmt.Sprintf("%s: %v", msg, err))
if JSON {
FatalT("{{.msg}}: {{.err}}", V{"msg": translate.T(msg), "err": err})
ErrT(style.Fatal, "{{.msg}}: {{.err}}", V{"msg": translate.T(msg), "err": err})
return
}
// use Warning because Error will display a duplicate message to stderr
ErrT(style.Empty, "")
FatalT("{{.msg}}: {{.err}}", V{"msg": translate.T(msg), "err": err})
ErrT(style.Fatal, "{{.msg}}: {{.err}}", V{"msg": translate.T(msg), "err": err})
ErrT(style.Empty, "")
displayGitHubIssueMessage()
}