Skip to content

Commit 0eafe04

Browse files
authored
Use ToString for CLI output (temporalio#542)
1 parent 004c86c commit 0eafe04

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

tools/cli/workflowCommands.go

+3-15
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,7 @@ func queryWorkflowHelper(c *cli.Context, queryType string) {
558558
if queryResponse.QueryRejected != nil {
559559
fmt.Printf("Query was rejected, workflow has status: %v\n", queryResponse.QueryRejected.GetStatus())
560560
} else {
561-
var queryResult string
562-
err = payloads.Decode(queryResponse.QueryResult, &queryResult)
563-
if err != nil {
564-
ErrorAndExit("Unable to decode query result.", err)
565-
}
561+
queryResult := payloads.ToString(queryResponse.QueryResult)
566562
fmt.Printf("Query result:\n%v\n", queryResult)
567563
}
568564
}
@@ -1086,11 +1082,7 @@ func printRunStatus(event *historypb.HistoryEvent) {
10861082
switch event.GetEventType() {
10871083
case enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED:
10881084
fmt.Printf(" Status: %s\n", colorGreen("COMPLETED"))
1089-
var result string
1090-
err := payloads.Decode(event.GetWorkflowExecutionCompletedEventAttributes().GetResult(), &result)
1091-
if err != nil {
1092-
ErrorAndExit("Unable ot decode WorkflowExecutionCompletedEventAttributes.Result.", err)
1093-
}
1085+
result := payloads.ToString(event.GetWorkflowExecutionCompletedEventAttributes().GetResult())
10941086
fmt.Printf(" Output: %s\n", result)
10951087
case enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_FAILED:
10961088
fmt.Printf(" Status: %s\n", colorRed("FAILED"))
@@ -1100,11 +1092,7 @@ func printRunStatus(event *historypb.HistoryEvent) {
11001092
fmt.Printf(" Retry status: %s\n", event.GetWorkflowExecutionTimedOutEventAttributes().GetRetryState())
11011093
case enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED:
11021094
fmt.Printf(" Status: %s\n", colorRed("CANCELED"))
1103-
var details string
1104-
err := payloads.Decode(event.GetWorkflowExecutionCanceledEventAttributes().GetDetails(), &details)
1105-
if err != nil {
1106-
ErrorAndExit("Unable ot decode WorkflowExecutionCanceledEventAttributes.Details.", err)
1107-
}
1095+
details := payloads.ToString(event.GetWorkflowExecutionCanceledEventAttributes().GetDetails())
11081096
fmt.Printf(" Detail: %s\n", details)
11091097
}
11101098
}

0 commit comments

Comments
 (0)