Skip to content

Commit

Permalink
Merge pull request #3072 from liron-l/detailed-error-message
Browse files Browse the repository at this point in the history
Detailed error message for execli errors
  • Loading branch information
dougm committed May 11, 2023
2 parents a939567 + e5f3cd0 commit 99cea86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion govc/host/esxcli/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ func (e *Executor) Execute(req *internal.ExecuteSoapRequest, res interface{}) er

if x.Returnval != nil {
if x.Returnval.Fault != nil {
return errors.New(x.Returnval.Fault.FaultMsg)
msg := x.Returnval.Fault.FaultMsg
if x.Returnval.Fault.FaultDetail != "" {
msg = fmt.Sprintf("%s %s", msg, x.Returnval.Fault.FaultDetail)
}
return errors.New(msg)
}

if err := xml.Unmarshal([]byte(x.Returnval.Response), res); err != nil {
Expand Down

0 comments on commit 99cea86

Please sign in to comment.