/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::DLM; using namespace Aws::DLM::Model; namespace Aws { namespace DLM { template<> AWS_DLM_API InternalServerException DLMError::GetModeledError() { assert(this->GetErrorType() == DLMErrors::INTERNAL_SERVER); return InternalServerException(this->GetJsonPayload().View()); } template<> AWS_DLM_API ResourceNotFoundException DLMError::GetModeledError() { assert(this->GetErrorType() == DLMErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } template<> AWS_DLM_API LimitExceededException DLMError::GetModeledError() { assert(this->GetErrorType() == DLMErrors::LIMIT_EXCEEDED); return LimitExceededException(this->GetJsonPayload().View()); } template<> AWS_DLM_API InvalidRequestException DLMError::GetModeledError() { assert(this->GetErrorType() == DLMErrors::INVALID_REQUEST); return InvalidRequestException(this->GetJsonPayload().View()); } namespace DLMErrorMapper { static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int LIMIT_EXCEEDED_HASH = HashingUtils::HashString("LimitExceededException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(DLMErrors::INTERNAL_SERVER), false); } else if (hashCode == LIMIT_EXCEEDED_HASH) { return AWSError(static_cast(DLMErrors::LIMIT_EXCEEDED), true); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(DLMErrors::INVALID_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace DLMErrorMapper } // namespace DLM } // namespace Aws