Merge pull request #15712 from rifelpet/warmpool

Log error when PutWarmPool fails
This commit is contained in:
Kubernetes Prow Robot 2023-07-28 20:01:42 -07:00 committed by GitHub
commit e3d4f5d2d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -99,7 +99,7 @@ func (*WarmPool) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *WarmPool) error
_, err := svc.PutWarmPool(request)
if err != nil {
if awsup.AWSErrorCode(err) == "ValidationError" {
return fi.NewTryAgainLaterError("waiting for ASG to become ready")
return fi.NewTryAgainLaterError("waiting for ASG to become ready").WithError(err)
}
return fmt.Errorf("error modifying warm pool: %w", err)
}

View File

@ -273,7 +273,8 @@ func (e *ExistsAndWarnIfChangesError) Error() string { return e.msg }
// TryAgainLaterError is the custom used when a task needs to fail validation with a message and try again later
type TryAgainLaterError struct {
msg string
msg string
inner error
}
// NewTryAgainLaterError is a builder for TryAgainLaterError.
@ -283,5 +284,17 @@ func NewTryAgainLaterError(message string) *TryAgainLaterError {
}
}
func (e *TryAgainLaterError) WithError(err error) *TryAgainLaterError {
e.inner = err
return e
}
// TryAgainLaterError implementation of the error interface.
func (e *TryAgainLaterError) Error() string { return e.msg }
func (e *TryAgainLaterError) Error() string {
if e.inner != nil {
return fmt.Sprintf("%v: %v", e.msg, e.inner)
}
return e.msg
}
func (e *TryAgainLaterError) Unwrap() error { return e.inner }