48 lines
1.3 KiB
C++
48 lines
1.3 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/signer/SignerErrors.h>
|
|
|
|
using namespace Aws::Client;
|
|
using namespace Aws::Utils;
|
|
using namespace Aws::signer;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace signer
|
|
{
|
|
namespace SignerErrorMapper
|
|
{
|
|
|
|
static const int NOT_FOUND_HASH = HashingUtils::HashString("NotFoundException");
|
|
static const int INTERNAL_SERVICE_ERROR_HASH = HashingUtils::HashString("InternalServiceErrorException");
|
|
static const int BAD_REQUEST_HASH = HashingUtils::HashString("BadRequestException");
|
|
|
|
|
|
AWSError<CoreErrors> GetErrorForName(const char* errorName)
|
|
{
|
|
int hashCode = HashingUtils::HashString(errorName);
|
|
|
|
if (hashCode == NOT_FOUND_HASH)
|
|
{
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(SignerErrors::NOT_FOUND), false);
|
|
}
|
|
else if (hashCode == INTERNAL_SERVICE_ERROR_HASH)
|
|
{
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(SignerErrors::INTERNAL_SERVICE_ERROR), false);
|
|
}
|
|
else if (hashCode == BAD_REQUEST_HASH)
|
|
{
|
|
return AWSError<CoreErrors>(static_cast<CoreErrors>(SignerErrors::BAD_REQUEST), false);
|
|
}
|
|
return AWSError<CoreErrors>(CoreErrors::UNKNOWN, false);
|
|
}
|
|
|
|
} // namespace SignerErrorMapper
|
|
} // namespace signer
|
|
} // namespace Aws
|