/** * 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::DataPipeline; namespace Aws { namespace DataPipeline { namespace DataPipelineErrorMapper { static const int INTERNAL_SERVICE_HASH = HashingUtils::HashString("InternalServiceError"); static const int TASK_NOT_FOUND_HASH = HashingUtils::HashString("TaskNotFoundException"); static const int PIPELINE_DELETED_HASH = HashingUtils::HashString("PipelineDeletedException"); static const int PIPELINE_NOT_FOUND_HASH = HashingUtils::HashString("PipelineNotFoundException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_SERVICE_HASH) { return AWSError(static_cast(DataPipelineErrors::INTERNAL_SERVICE), false); } else if (hashCode == TASK_NOT_FOUND_HASH) { return AWSError(static_cast(DataPipelineErrors::TASK_NOT_FOUND), false); } else if (hashCode == PIPELINE_DELETED_HASH) { return AWSError(static_cast(DataPipelineErrors::PIPELINE_DELETED), false); } else if (hashCode == PIPELINE_NOT_FOUND_HASH) { return AWSError(static_cast(DataPipelineErrors::PIPELINE_NOT_FOUND), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(DataPipelineErrors::INVALID_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace DataPipelineErrorMapper } // namespace DataPipeline } // namespace Aws