/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::CloudSearch; namespace Aws { namespace CloudSearch { namespace CloudSearchErrorMapper { static const int INTERNAL_HASH = HashingUtils::HashString("InternalException"); static const int DISABLED_OPERATION_HASH = HashingUtils::HashString("DisabledAction"); static const int RESOURCE_ALREADY_EXISTS_HASH = HashingUtils::HashString("ResourceAlreadyExists"); static const int BASE_HASH = HashingUtils::HashString("BaseException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceeded"); static const int INVALID_TYPE_HASH = HashingUtils::HashString("InvalidType"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_HASH) { return AWSError(static_cast(CloudSearchErrors::INTERNAL), true); } else if (hashCode == DISABLED_OPERATION_HASH) { return AWSError(static_cast(CloudSearchErrors::DISABLED_OPERATION), false); } else if (hashCode == RESOURCE_ALREADY_EXISTS_HASH) { return AWSError(static_cast(CloudSearchErrors::RESOURCE_ALREADY_EXISTS), false); } else if (hashCode == BASE_HASH) { return AWSError(static_cast(CloudSearchErrors::BASE), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(CloudSearchErrors::LIMIT_EXCEEDED), true); } else if (hashCode == INVALID_TYPE_HASH) { return AWSError(static_cast(CloudSearchErrors::INVALID_TYPE), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace CloudSearchErrorMapper } // namespace CloudSearch } // namespace Aws