Merge branch 'dtolnay-timeouterror'

This commit is contained in:
James Nugent 2016-08-22 10:35:04 +02:00
commit a69c62af65
1 changed files with 7 additions and 5 deletions

View File

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