/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::Account; using namespace Aws::Account::Model; namespace Aws { namespace Account { template<> AWS_ACCOUNT_API ValidationException AccountError::GetModeledError() { assert(this->GetErrorType() == AccountErrors::VALIDATION); return ValidationException(this->GetJsonPayload().View()); } namespace AccountErrorMapper { static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int TOO_MANY_REQUESTS_HASH = HashingUtils::HashString("TooManyRequestsException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(AccountErrors::CONFLICT), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(AccountErrors::INTERNAL_SERVER), false); } else if (hashCode == TOO_MANY_REQUESTS_HASH) { return AWSError(static_cast(AccountErrors::TOO_MANY_REQUESTS), true); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace AccountErrorMapper } // namespace Account } // namespace Aws