Interface: awserr.RequestFailure
Overview
A RequestFailure is an interface to extract request failure information from an Error such as the request ID of the failed request returned by a service. RequestFailures may not always have a requestID value if the request failed prior to reaching the service such as a connection error.
Example:
output, err := s3manage.Upload(svc, input, opts)
if err != nil {
if reqerr, ok := err.(RequestFailure); ok {
log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID())
} else {
log.Println("Error:", err.Error())
}
}
Combined with awserr.Error:
output, err := s3manage.Upload(svc, input, opts)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.StatusCode(), reqErr.RequestID())
}
} else {
fmt.Println(err.Error())
}
}
Implemented By
kms.AlreadyExistsException, kms.CloudHsmClusterInUseException, kms.CloudHsmClusterInvalidConfigurationException, kms.CloudHsmClusterNotActiveException, kms.CloudHsmClusterNotFoundException, kms.CloudHsmClusterNotRelatedException, kms.CustomKeyStoreHasCMKsException, kms.CustomKeyStoreInvalidStateException, kms.CustomKeyStoreNameInUseException, kms.CustomKeyStoreNotFoundException, kms.DependencyTimeoutException, kms.DisabledException, kms.ExpiredImportTokenException, kms.IncorrectKeyException, kms.IncorrectKeyMaterialException, kms.IncorrectTrustAnchorException, kms.InternalException, kms.InvalidAliasNameException, kms.InvalidArnException, kms.InvalidCiphertextException, kms.InvalidGrantIdException, kms.InvalidGrantTokenException, kms.InvalidImportTokenException, kms.InvalidKeyUsageException, kms.InvalidMarkerException, kms.InvalidStateException, kms.KMSInvalidSignatureException, kms.KeyUnavailableException, kms.LimitExceededException, kms.MalformedPolicyDocumentException, kms.NotFoundException, kms.TagException, kms.UnsupportedOperationException
Interface Method Summary collapse
-
RequestID() string
interface
The request ID returned by the service for a request failure.
-
StatusCode() int
interface
The status code of the HTTP response.
Methods included from awserr.Error
awserr.Error.Code(), awserr.Error.Message(), awserr.Error.OrigErr()
Interface Method Details
RequestID() string
The request ID returned by the service for a request failure. This will be empty if no request ID is available such as the request failed due to a connection error.
135 |
// File 'aws/awserr/error.go', line 135
|
StatusCode() int
The status code of the HTTP response.
130 |
// File 'aws/awserr/error.go', line 130
|