Change error message return structure

This commit is contained in:
James Nugent 2016-08-22 10:34:32 +02:00
parent 9d3f40a513
commit 0a5acaa0d8
1 changed files with 5 additions and 4 deletions

View File

@ -44,10 +44,11 @@ type TimeoutError struct {
}
func (e *TimeoutError) Error() string {
msg := fmt.Sprintf("timeout while waiting for state to become '%s'",
strings.Join(e.ExpectedState, ", "))
if e.LastError != nil {
msg += fmt.Sprintf(". last error: %s", e.LastError)
return fmt.Sprintf("timeout while waiting for state to become '%s': %s",
strings.Join(e.ExpectedState, ", "), e.LastError)
}
return msg
return fmt.Sprintf("timeout while waiting for state to become '%s'",
strings.Join(e.ExpectedState, ", "))
}