From 219473fb60d35ba1594c8b9a34eb537c59a0ebc0 Mon Sep 17 00:00:00 2001 From: sophia Date: Tue, 11 Jan 2022 09:49:41 -0600 Subject: [PATCH] Seach for localized error message in error details --- internal/cli/dynamic.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/cli/dynamic.go b/internal/cli/dynamic.go index bbc630a97..fba7cb98f 100644 --- a/internal/cli/dynamic.go +++ b/internal/cli/dynamic.go @@ -97,9 +97,12 @@ func (c *DynamicCommand) Run(args []string) int { } else if !r.RunResult { runErrorStatus := status.FromProto(r.RunError) details := runErrorStatus.Details() - // TODO: seach through the details for a localized message if exists - userMessage := details[0].(*vagrant_plugin_sdk.Errors_LocalizedErrorMessage).Message - cl.UI().Output("Error: "+userMessage+"\n", terminal.WithErrorStyle()) + for _, msg := range details { + switch m := msg.(type) { + case *vagrant_plugin_sdk.Errors_LocalizedErrorMessage: + cl.UI().Output("Error: "+m.Message+"\n", terminal.WithErrorStyle()) + } + } runErr := status.FromProto(r.RunError) err = fmt.Errorf("execution failed, %w", runErr.Err()) }