/** * 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::CodeStarconnections; namespace Aws { namespace CodeStarconnections { namespace CodeStarconnectionsErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); static const int UNSUPPORTED_OPERATION_HASH = HashingUtils::HashString("UnsupportedOperationException"); static const int RESOURCE_UNAVAILABLE_HASH = HashingUtils::HashString("ResourceUnavailableException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(CodeStarconnectionsErrors::CONFLICT), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(CodeStarconnectionsErrors::LIMIT_EXCEEDED), true); } else if (hashCode == UNSUPPORTED_OPERATION_HASH) { return AWSError(static_cast(CodeStarconnectionsErrors::UNSUPPORTED_OPERATION), false); } else if (hashCode == RESOURCE_UNAVAILABLE_HASH) { return AWSError(static_cast(CodeStarconnectionsErrors::RESOURCE_UNAVAILABLE), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace CodeStarconnectionsErrorMapper } // namespace CodeStarconnections } // namespace Aws