/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::Comprehend; using namespace Aws::Comprehend::Model; namespace Aws { namespace Comprehend { template<> AWS_COMPREHEND_API InvalidRequestException ComprehendError::GetModeledError() { assert(this->GetErrorType() == ComprehendErrors::INVALID_REQUEST); return InvalidRequestException(this->GetJsonPayload().View()); } namespace ComprehendErrorMapper { static const int UNSUPPORTED_LANGUAGE_HASH = HashingUtils::HashString("UnsupportedLanguageException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int CONCURRENT_MODIFICATION_HASH = HashingUtils::HashString("ConcurrentModificationException"); static const int BATCH_SIZE_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("BatchSizeLimitExceededException"); static const int KMS_KEY_VALIDATION_HASH = HashingUtils::HashString("KmsKeyValidationException"); static const int JOB_NOT_FOUND_HASH = HashingUtils::HashString("JobNotFoundException"); static const int RESOURCE_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("ResourceLimitExceededException"); static const int TOO_MANY_TAGS_HASH = HashingUtils::HashString("TooManyTagsException"); static const int TOO_MANY_TAG_KEYS_HASH = HashingUtils::HashString("TooManyTagKeysException"); static const int TOO_MANY_REQUESTS_HASH = HashingUtils::HashString("TooManyRequestsException"); static const int INVALID_FILTER_HASH = HashingUtils::HashString("InvalidFilterException"); static const int RESOURCE_IN_USE_HASH = HashingUtils::HashString("ResourceInUseException"); static const int RESOURCE_UNAVAILABLE_HASH = HashingUtils::HashString("ResourceUnavailableException"); static const int TEXT_SIZE_LIMIT_EXCEEDED_HASH = HashingUtils::HashString("TextSizeLimitExceededException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == UNSUPPORTED_LANGUAGE_HASH) { return AWSError(static_cast(ComprehendErrors::UNSUPPORTED_LANGUAGE), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(ComprehendErrors::INTERNAL_SERVER), false); } else if (hashCode == CONCURRENT_MODIFICATION_HASH) { return AWSError(static_cast(ComprehendErrors::CONCURRENT_MODIFICATION), false); } else if (hashCode == BATCH_SIZE_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(ComprehendErrors::BATCH_SIZE_LIMIT_EXCEEDED), false); } else if (hashCode == KMS_KEY_VALIDATION_HASH) { return AWSError(static_cast(ComprehendErrors::KMS_KEY_VALIDATION), false); } else if (hashCode == JOB_NOT_FOUND_HASH) { return AWSError(static_cast(ComprehendErrors::JOB_NOT_FOUND), false); } else if (hashCode == RESOURCE_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(ComprehendErrors::RESOURCE_LIMIT_EXCEEDED), false); } else if (hashCode == TOO_MANY_TAGS_HASH) { return AWSError(static_cast(ComprehendErrors::TOO_MANY_TAGS), false); } else if (hashCode == TOO_MANY_TAG_KEYS_HASH) { return AWSError(static_cast(ComprehendErrors::TOO_MANY_TAG_KEYS), false); } else if (hashCode == TOO_MANY_REQUESTS_HASH) { return AWSError(static_cast(ComprehendErrors::TOO_MANY_REQUESTS), true); } else if (hashCode == INVALID_FILTER_HASH) { return AWSError(static_cast(ComprehendErrors::INVALID_FILTER), false); } else if (hashCode == RESOURCE_IN_USE_HASH) { return AWSError(static_cast(ComprehendErrors::RESOURCE_IN_USE), false); } else if (hashCode == RESOURCE_UNAVAILABLE_HASH) { return AWSError(static_cast(ComprehendErrors::RESOURCE_UNAVAILABLE), false); } else if (hashCode == TEXT_SIZE_LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(ComprehendErrors::TEXT_SIZE_LIMIT_EXCEEDED), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(ComprehendErrors::INVALID_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace ComprehendErrorMapper } // namespace Comprehend } // namespace Aws