/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::Transfer; using namespace Aws::Transfer::Model; namespace Aws { namespace Transfer { template<> AWS_TRANSFER_API ResourceExistsException TransferError::GetModeledError() { assert(this->GetErrorType() == TransferErrors::RESOURCE_EXISTS); return ResourceExistsException(this->GetJsonPayload().View()); } template<> AWS_TRANSFER_API ThrottlingException TransferError::GetModeledError() { assert(this->GetErrorType() == TransferErrors::THROTTLING); return ThrottlingException(this->GetJsonPayload().View()); } template<> AWS_TRANSFER_API ResourceNotFoundException TransferError::GetModeledError() { assert(this->GetErrorType() == TransferErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } namespace TransferErrorMapper { static const int RESOURCE_EXISTS_HASH = HashingUtils::HashString("ResourceExistsException"); static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException"); static const int INTERNAL_SERVICE_HASH = HashingUtils::HashString("InternalServiceError"); static const int INVALID_NEXT_TOKEN_HASH = HashingUtils::HashString("InvalidNextTokenException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == RESOURCE_EXISTS_HASH) { return AWSError(static_cast(TransferErrors::RESOURCE_EXISTS), false); } else if (hashCode == CONFLICT_HASH) { return AWSError(static_cast(TransferErrors::CONFLICT), false); } else if (hashCode == INTERNAL_SERVICE_HASH) { return AWSError(static_cast(TransferErrors::INTERNAL_SERVICE), false); } else if (hashCode == INVALID_NEXT_TOKEN_HASH) { return AWSError(static_cast(TransferErrors::INVALID_NEXT_TOKEN), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(TransferErrors::INVALID_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace TransferErrorMapper } // namespace Transfer } // namespace Aws