/** * 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::RedshiftDataAPIService; using namespace Aws::RedshiftDataAPIService::Model; namespace Aws { namespace RedshiftDataAPIService { template<> AWS_REDSHIFTDATAAPISERVICE_API BatchExecuteStatementException RedshiftDataAPIServiceError::GetModeledError() { assert(this->GetErrorType() == RedshiftDataAPIServiceErrors::BATCH_EXECUTE_STATEMENT); return BatchExecuteStatementException(this->GetJsonPayload().View()); } template<> AWS_REDSHIFTDATAAPISERVICE_API ExecuteStatementException RedshiftDataAPIServiceError::GetModeledError() { assert(this->GetErrorType() == RedshiftDataAPIServiceErrors::EXECUTE_STATEMENT); return ExecuteStatementException(this->GetJsonPayload().View()); } template<> AWS_REDSHIFTDATAAPISERVICE_API ResourceNotFoundException RedshiftDataAPIServiceError::GetModeledError() { assert(this->GetErrorType() == RedshiftDataAPIServiceErrors::RESOURCE_NOT_FOUND); return ResourceNotFoundException(this->GetJsonPayload().View()); } namespace RedshiftDataAPIServiceErrorMapper { static const int BATCH_EXECUTE_STATEMENT_HASH = HashingUtils::HashString("BatchExecuteStatementException"); static const int EXECUTE_STATEMENT_HASH = HashingUtils::HashString("ExecuteStatementException"); static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException"); static const int DATABASE_CONNECTION_HASH = HashingUtils::HashString("DatabaseConnectionException"); static const int ACTIVE_STATEMENTS_EXCEEDED_HASH = HashingUtils::HashString("ActiveStatementsExceededException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == BATCH_EXECUTE_STATEMENT_HASH) { return AWSError(static_cast(RedshiftDataAPIServiceErrors::BATCH_EXECUTE_STATEMENT), false); } else if (hashCode == EXECUTE_STATEMENT_HASH) { return AWSError(static_cast(RedshiftDataAPIServiceErrors::EXECUTE_STATEMENT), false); } else if (hashCode == INTERNAL_SERVER_HASH) { return AWSError(static_cast(RedshiftDataAPIServiceErrors::INTERNAL_SERVER), false); } else if (hashCode == DATABASE_CONNECTION_HASH) { return AWSError(static_cast(RedshiftDataAPIServiceErrors::DATABASE_CONNECTION), false); } else if (hashCode == ACTIVE_STATEMENTS_EXCEEDED_HASH) { return AWSError(static_cast(RedshiftDataAPIServiceErrors::ACTIVE_STATEMENTS_EXCEEDED), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace RedshiftDataAPIServiceErrorMapper } // namespace RedshiftDataAPIService } // namespace Aws