Fix bad message from TimeoutError

Before:

    Error creating IAM Role my-role: timeout while waiting for state
    to become 'success'. last error: %!s(<nil>)
This commit is contained in:
David Tolnay 2016-07-20 16:18:40 -07:00 committed by James Nugent
parent 041094fb85
commit 9d3f40a513
1 changed files with 6 additions and 5 deletions

View File

@ -44,9 +44,10 @@ 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,
)
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 msg
}