Merge pull request #1658 from justinsb/log_error_details

Improve error logging
This commit is contained in:
Chris Love 2017-01-28 19:51:49 -07:00 committed by GitHub
commit 9c07159d4d
1 changed files with 10 additions and 1 deletions

View File

@ -17,6 +17,7 @@ limitations under the License.
package awsup
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/golang/glog"
@ -47,7 +48,15 @@ func (l LoggingRetryer) RetryRules(r *request.Request) time.Duration {
}
methodDescription := service + "/" + name
glog.Infof("Retryable error %d (%s) from %s - will retry after delay of %v", r.HTTPResponse.StatusCode, r.HTTPResponse.Status, methodDescription, duration)
var errorDescription string
if r.Error != nil {
// We could check aws error Code & Message, but we expect them to be in the string
errorDescription = fmt.Sprintf("%v", r.Error)
} else {
errorDescription = fmt.Sprintf("%d %s", r.HTTPResponse.StatusCode, r.HTTPResponse.Status)
}
glog.Infof("Retryable error (%s) from %s - will retry after delay of %v", errorDescription, methodDescription, duration)
return duration
}