/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Client; using namespace Aws::Utils; using namespace Aws::CloudHSM; using namespace Aws::CloudHSM::Model; namespace Aws { namespace CloudHSM { template<> AWS_CLOUDHSM_API CloudHsmServiceException CloudHSMError::GetModeledError() { assert(this->GetErrorType() == CloudHSMErrors::CLOUD_HSM_SERVICE); return CloudHsmServiceException(this->GetJsonPayload().View()); } namespace CloudHSMErrorMapper { static const int CLOUD_HSM_SERVICE_HASH = HashingUtils::HashString("CloudHsmServiceException"); static const int CLOUD_HSM_INTERNAL_HASH = HashingUtils::HashString("CloudHsmInternalException"); static const int INVALID_REQUEST_HASH = HashingUtils::HashString("InvalidRequestException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == CLOUD_HSM_SERVICE_HASH) { return AWSError(static_cast(CloudHSMErrors::CLOUD_HSM_SERVICE), false); } else if (hashCode == CLOUD_HSM_INTERNAL_HASH) { return AWSError(static_cast(CloudHSMErrors::CLOUD_HSM_INTERNAL), false); } else if (hashCode == INVALID_REQUEST_HASH) { return AWSError(static_cast(CloudHSMErrors::INVALID_REQUEST), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace CloudHSMErrorMapper } // namespace CloudHSM } // namespace Aws