Interface: awserr.Error
Overview
An Error wraps lower level errors with code, message and an original error. The underlying concrete error type may also satisfy other interfaces which can be to used to obtain more specific information about the error.
Calling Error() or String() will always include the full information about an error based on its underlying type.
Example:
output, err := s3manage.Upload(svc, input, opts)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Get error details
log.Println("Error:", awsErr.Code(), awsErr.Message())
// Prints out full error message, including original error if there was one.
log.Println("Error:", awsErr.Error())
// Get original error
if origErr := awsErr.OrigErr(); origErr != nil {
// operate on original error.
}
} else {
fmt.Println(err.Error())
}
}
Implemented By
kms.AlreadyExistsException, s3manager.BatchError, kms.CloudHsmClusterInUseException, kms.CloudHsmClusterInvalidConfigurationException, kms.CloudHsmClusterNotActiveException, kms.CloudHsmClusterNotFoundException, kms.CloudHsmClusterNotRelatedException, kms.CustomKeyStoreHasCMKsException, kms.CustomKeyStoreInvalidStateException, kms.CustomKeyStoreNameInUseException, kms.CustomKeyStoreNotFoundException, kms.DependencyTimeoutException, kms.DisabledException, request.ErrInvalidParams, 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, session.SharedConfigAssumeRoleError, session.SharedConfigLoadError, session.SharedConfigProfileNotExistsError, kms.TagException, kms.UnsupportedOperationException
Interface Method Summary collapse
-
Code() string
interface
Returns the short phrase depicting the classification of the error.
-
Message() string
interface
Returns the error details message.
-
OrigErr() error
interface
Returns the original error if one was set.
Interface Method Details
Code() string
Returns the short phrase depicting the classification of the error.
34 |
// File 'aws/awserr/error.go', line 34
|
Message() string
Returns the error details message.
37 |
// File 'aws/awserr/error.go', line 37
|
OrigErr() error
Returns the original error if one was set. Nil is returned if not set.
40 |
// File 'aws/awserr/error.go', line 40
|