/** * 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::Pricing; namespace Aws { namespace Pricing { namespace PricingErrorMapper { static const int INTERNAL_ERROR_HASH = HashingUtils::HashString("InternalErrorException"); static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFoundException"); static const int INVALID_PARAMETER_HASH = HashingUtils::HashString("InvalidParameterException"); static const int INVALID_NEXT_TOKEN_HASH = HashingUtils::HashString("InvalidNextTokenException"); static const int EXPIRED_NEXT_TOKEN_HASH = HashingUtils::HashString("ExpiredNextTokenException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_ERROR_HASH) { return AWSError(static_cast(PricingErrors::INTERNAL_ERROR), false); } else if (hashCode == NOT_FOUND_HASH) { return AWSError(static_cast(PricingErrors::NOT_FOUND), false); } else if (hashCode == INVALID_PARAMETER_HASH) { return AWSError(static_cast(PricingErrors::INVALID_PARAMETER), false); } else if (hashCode == INVALID_NEXT_TOKEN_HASH) { return AWSError(static_cast(PricingErrors::INVALID_NEXT_TOKEN), false); } else if (hashCode == EXPIRED_NEXT_TOKEN_HASH) { return AWSError(static_cast(PricingErrors::EXPIRED_NEXT_TOKEN), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace PricingErrorMapper } // namespace Pricing } // namespace Aws