You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Module: Aws::KMS::Errors

Defined in:


When AWS Key Management Service returns an error response, the Ruby SDK constructs and raises an error. These errors have the following ancestors:

You can rescue all KMS errors using ServiceError:

# rescue all errors from AWS Key Management Service
  # do stuff
rescue Aws::KMS::Errors::ServiceError
  # ...

Request Context

ServiceError objects have a #context method that returns information about the request that generated the error, including:

  • #params - The request params
  • #operation_name - Name of the API operation invoked
  • #http_request
  • #http_response
  • etc ...

See Seahorse::Client::RequestContext for more information.

Error Classes

You can rescue a specific error using the error code:

  # do stuff
rescue Aws::KMS::Errors::AlreadyExistsException
  # ...

Some of the common errors are listed below:

Defined Under Namespace

Classes: AlreadyExistsException, CloudHsmClusterInUseException, CloudHsmClusterInvalidConfigurationException, CloudHsmClusterNotActiveException, CloudHsmClusterNotFoundException, CloudHsmClusterNotRelatedException, CustomKeyStoreHasCMKsException, CustomKeyStoreInvalidStateException, CustomKeyStoreNameInUseException, CustomKeyStoreNotFoundException, DependencyTimeoutException, DisabledException, ExpiredImportTokenException, IncorrectKeyException, IncorrectKeyMaterialException, IncorrectTrustAnchorException, InvalidAliasNameException, InvalidArnException, InvalidCiphertextException, InvalidGrantIdException, InvalidGrantTokenException, InvalidImportTokenException, InvalidKeyUsageException, InvalidMarkerException, KMSInternalException, KMSInvalidSignatureException, KMSInvalidStateException, KeyUnavailableException, LimitExceededException, MalformedPolicyDocumentException, NotFoundException, ServiceError, TagException, UnsupportedOperationException