/** * 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::Connect; namespace Aws { namespace Connect { namespace ConnectErrorMapper { static const int CONTACT_NOT_FOUND_HASH = HashingUtils::HashString("ContactNotFoundException"); static const int INVALID_PARAMETER_HASH = HashingUtils::HashString("InvalidParameterException"); static const int USER_NOT_FOUND_HASH = HashingUtils::HashString("UserNotFoundException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); static const int DUPLICATE_RESOURCE_HASH = HashingUtils::HashString("DuplicateResourceException"); static const int DESTINATION_NOT_ALLOWED_HASH = HashingUtils::HashString("DestinationNotAllowedException"); static const int INTERNAL_SERVICE_HASH = HashingUtils::HashString("InternalServiceException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); static const int OUTBOUND_CONTACT_NOT_PERMITTED_HASH = HashingUtils::HashString("OutboundContactNotPermittedException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONTACT_NOT_FOUND_HASH) { return AWSError(static_cast(ConnectErrors::CONTACT_NOT_FOUND), false); } else if (hashCode == INVALID_PARAMETER_HASH) { return AWSError(static_cast(ConnectErrors::INVALID_PARAMETER), false); } else if (hashCode == USER_NOT_FOUND_HASH) { return AWSError(static_cast(ConnectErrors::USER_NOT_FOUND), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(ConnectErrors::LIMIT_EXCEEDED), true); } else if (hashCode == DUPLICATE_RESOURCE_HASH) { return AWSError(static_cast(ConnectErrors::DUPLICATE_RESOURCE), false); } else if (hashCode == DESTINATION_NOT_ALLOWED_HASH) { return AWSError(static_cast(ConnectErrors::DESTINATION_NOT_ALLOWED), false); } else if (hashCode == INTERNAL_SERVICE_HASH) { return AWSError(static_cast(ConnectErrors::INTERNAL_SERVICE), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(ConnectErrors::INVALID_REQUEST), false); } else if (hashCode == OUTBOUND_CONTACT_NOT_PERMITTED_HASH) { return AWSError(static_cast(ConnectErrors::OUTBOUND_CONTACT_NOT_PERMITTED), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace ConnectErrorMapper } // namespace Connect } // namespace Aws