68 lines
2.4 KiB
C++
68 lines
2.4 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/core/client/AWSError.h>
|
|||
|
|
#include <aws/core/utils/HashingUtils.h>
|
|||
|
|
#include <aws/resource-groups/ResourceGroupsErrors.h>
|
|||
|
|
|
|||
|
|
using namespace Aws::Client;
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
using namespace Aws::ResourceGroups;
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace ResourceGroups
|
|||
|
|
{
|
|||
|
|
namespace ResourceGroupsErrorMapper
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFoundException");
|
|||
|
|
static const int FORBIDDEN_HASH = HashingUtils::HashString("ForbiddenException");
|
|||
|
|
static const int UNAUTHORIZED_HASH = HashingUtils::HashString("UnauthorizedException");
|
|||
|
|
static const int TOO_MANY_REQUESTS_HASH = HashingUtils::HashString("TooManyRequestsException");
|
|||
|
|
static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException");
|
|||
|
|
static const int INTERNAL_SERVER_ERROR_HASH = HashingUtils::HashString("InternalServerErrorException");
|
|||
|
|
static const int METHOD_NOT_ALLOWED_HASH = HashingUtils::HashString("MethodNotAllowedException");
|
|||
|
|
|
|||
|
|
|
|||
|
|
AWSError<CoreErrors> GetErrorForName(const char* errorName)
|
|||
|
|
{
|
|||
|
|
int hashCode = HashingUtils::HashString(errorName);
|
|||
|
|
|
|||
|
|
if (hashCode == NOT_FOUND_HASH)
|
|||
|
|
{
|
|||
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(ResourceGroupsErrors::NOT_FOUND), false);
|
|||
|
|
}
|
|||
|
|
else if (hashCode == FORBIDDEN_HASH)
|
|||
|
|
{
|
|||
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(ResourceGroupsErrors::FORBIDDEN), false);
|
|||
|
|
}
|
|||
|
|
else if (hashCode == UNAUTHORIZED_HASH)
|
|||
|
|
{
|
|||
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(ResourceGroupsErrors::UNAUTHORIZED), false);
|
|||
|
|
}
|
|||
|
|
else if (hashCode == TOO_MANY_REQUESTS_HASH)
|
|||
|
|
{
|
|||
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(ResourceGroupsErrors::TOO_MANY_REQUESTS), true);
|
|||
|
|
}
|
|||
|
|
else if (hashCode == BAD_REQUEST_HASH)
|
|||
|
|
{
|
|||
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(ResourceGroupsErrors::BAD_REQUEST), false);
|
|||
|
|
}
|
|||
|
|
else if (hashCode == INTERNAL_SERVER_ERROR_HASH)
|
|||
|
|
{
|
|||
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(ResourceGroupsErrors::INTERNAL_SERVER_ERROR), false);
|
|||
|
|
}
|
|||
|
|
else if (hashCode == METHOD_NOT_ALLOWED_HASH)
|
|||
|
|
{
|
|||
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(ResourceGroupsErrors::METHOD_NOT_ALLOWED), false);
|
|||
|
|
}
|
|||
|
|
return AWSError<CoreErrors>(CoreErrors::UNKNOWN, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace ResourceGroupsErrorMapper
|
|||
|
|
} // namespace ResourceGroups
|
|||
|
|
} // namespace Aws
|