/** * 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::PI; namespace Aws { namespace PI { namespace PIErrorMapper { static const int INTERNAL_SERVICE_HASH = HashingUtils::HashString("InternalServiceError"); static const int NOT_AUTHORIZED_HASH = HashingUtils::HashString("NotAuthorizedException"); static const int INVALID_ARGUMENT_HASH = HashingUtils::HashString("InvalidArgumentException"); AWSError GetErrorForName(const char* errorName) { int hashCode = HashingUtils::HashString(errorName); if (hashCode == INTERNAL_SERVICE_HASH) { return AWSError(static_cast(PIErrors::INTERNAL_SERVICE), false); } else if (hashCode == NOT_AUTHORIZED_HASH) { return AWSError(static_cast(PIErrors::NOT_AUTHORIZED), false); } else if (hashCode == INVALID_ARGUMENT_HASH) { return AWSError(static_cast(PIErrors::INVALID_ARGUMENT), false); } return AWSError(CoreErrors::UNKNOWN, false); } } // namespace PIErrorMapper } // namespace PI } // namespace Aws