Seach for localized error message in error details

This commit is contained in:
sophia 2022-01-11 09:49:41 -06:00 committed by Paul Hinze
parent a62c3d69cf
commit 219473fb60
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -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())
}