/** * 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::RoboMaker; namespace Aws { namespace RoboMaker { namespace RoboMakerErrorMapper { static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int INVALID_PARAMETER_HASH = HashingUtils::HashString("InvalidParameterException"); static const int RESOURCE_ALREADY_EXISTS_HASH = HashingUtils::HashString("ResourceAlreadyExistsException"); static const int IDEMPOTENT_PARAMETER_MISMATCH_HASH = HashingUtils::HashString("IdempotentParameterMismatchException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(RoboMakerErrors::INTERNAL_SERVER), false); } else if (hashCode == INVALID_PARAMETER_HASH) { return AWSError(static_cast(RoboMakerErrors::INVALID_PARAMETER), false); } else if (hashCode == RESOURCE_ALREADY_EXISTS_HASH) { return AWSError(static_cast(RoboMakerErrors::RESOURCE_ALREADY_EXISTS), false); } else if (hashCode == IDEMPOTENT_PARAMETER_MISMATCH_HASH) { return AWSError(static_cast(RoboMakerErrors::IDEMPOTENT_PARAMETER_MISMATCH), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(RoboMakerErrors::LIMIT_EXCEEDED), true); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace RoboMakerErrorMapper } // namespace RoboMaker } // namespace Aws