in common/src/main/java/software/amazon/kms/common/AbstractKmsApiHelper.java [42:71]
protected <T> T wrapKmsExceptions(final String operation, final Supplier<T> serviceCall) {
try {
return serviceCall.get();
} catch (final AlreadyExistsException e) {
throw new CfnAlreadyExistsException(addMessageIfNull(operation, e));
} catch (final InvalidAliasNameException | KmsInvalidStateException | InvalidArnException |
MalformedPolicyDocumentException | TagException | UnsupportedOperationException |
DisabledException e) {
throw new CfnInvalidRequestException(addMessageIfNull(operation, e));
} catch (final LimitExceededException e) {
throw new CfnServiceLimitExceededException(addMessageIfNull(operation, e));
} catch (final InvalidMarkerException e) {
// We should never make a call with an invalid marker, if we did, there is an issue
throw new CfnInternalFailureException(addMessageIfNull(operation, e));
} catch (final KmsInternalException | DependencyTimeoutException e) {
throw new CfnServiceInternalErrorException(operation, e);
} catch (final NotFoundException e) {
throw new CfnNotFoundException(addMessageIfNull(operation, e));
} catch (final KmsException e) {
if (ACCESS_DENIED_ERROR_CODE.equals(e.awsErrorDetails().errorCode())) {
throw new CfnAccessDeniedException(operation, e);
} else if (VALIDATION_ERROR_CODE.equals(e.awsErrorDetails().errorCode())) {
throw new CfnInvalidRequestException(addMessageIfNull(operation, e));
} else if (THROTTLING_ERROR_CODE.equals(e.awsErrorDetails().errorCode())) {
throw new CfnThrottlingException(operation, e);
}
throw new CfnGeneralServiceException(operation, e);
}
}