Skip to content

Commit 887a295

Browse files
committed
Show simple warning message from the message queue.
1 parent 9602113 commit 887a295

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

cmd/state/internal/cmdtree/exechandlers/messages/messenger.go

+3-13
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,7 @@ func (m *Messenger) OnExecStart(_ *captain.Command, _ []string) error {
6262
}
6363

6464
func (m *Messenger) handleErrorMessages(message *graph.Message) {
65-
switch message.Topic {
66-
case msgs.TopicErrorAuth:
67-
logging.Error("State Service reported an authentication error: %s", message.Message)
68-
err := locale.NewError("err_svc_message", "The State Service reported an authentication error: {{.V0}}", message.Message)
69-
m.out.Error(err)
70-
case msgs.TopicErrorAuthToken:
71-
logging.Error("State Service reported an authentication token error: %s", message.Message)
72-
err := locale.NewError("err_svc_invalid_token", "", message.Message)
73-
m.out.Error(err)
74-
default:
75-
logging.Error("State Service reported an unknown error: %s", message.Topic)
76-
m.out.Error(locale.NewError("err_svc_unknown_message", "The State Service reported an unknown error: {{.V0}}", message.Message))
77-
}
65+
logging.Error("State Service reported a %s error: %s", message.Topic, message.Message)
66+
err := locale.NewError("err_svc_message", "[WARNING]Warning:[/RESET] {{.V0}}", message.Message)
67+
m.out.Error(err)
7868
}

test/integration/auth_int_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ func (suite *AuthIntegrationTestSuite) TestAuth_InvalidToken() {
120120

121121
cp := ts.SpawnWithOpts(e2e.OptArgs("--version"), e2e.OptAppendEnv(constants.APIKeyEnvVarName+"=bad-token"))
122122
// Message is displayed
123-
cp.Expect("The State Service reported an invalid API token error: Invalid API token")
124-
cp.Expect("Please check your API token and try again.")
123+
cp.Expect("Warning: Invalid API token")
125124
// The version information is still displayed
126125
cp.Expect("ActiveState CLI")
127126
cp.Expect("Version")

0 commit comments

Comments
 (0)