Merge branch 'main' of https://github.com/jay0lee/GAM into main

This commit is contained in:
Jay Lee
2021-10-21 08:06:39 -04:00
3 changed files with 13 additions and 1 deletions

View File

@ -7244,6 +7244,7 @@ def enableGAMProjectAPIs(GAMProjectAPIs,
gapi_errors.ErrorReason.FORBIDDEN, gapi_errors.ErrorReason.FORBIDDEN,
gapi_errors.ErrorReason.PERMISSION_DENIED gapi_errors.ErrorReason.PERMISSION_DENIED
], ],
retry_reasons=[gapi_errors.ErrorReason.INTERNAL_SERVER_ERROR],
name=service_name) name=service_name)
print(f' API: {api}, Enabled{currentCount(j, jcount)}') print(f' API: {api}, Enabled{currentCount(j, jcount)}')
break break

View File

@ -60,6 +60,10 @@ class GapiGroupNotFoundError(Exception):
pass pass
class GapiInternalServerError(Exception):
pass
class GapiInvalidError(Exception): class GapiInvalidError(Exception):
pass pass
@ -125,6 +129,7 @@ class ErrorReason(Enum):
GATEWAY_TIMEOUT = 'gatewayTimeout' GATEWAY_TIMEOUT = 'gatewayTimeout'
GROUP_NOT_FOUND = 'groupNotFound' GROUP_NOT_FOUND = 'groupNotFound'
INTERNAL_ERROR = 'internalError' INTERNAL_ERROR = 'internalError'
INTERNAL_SERVER_ERROR = 'internalServerError'
INVALID = 'invalid' INVALID = 'invalid'
INVALID_ARGUMENT = 'invalidArgument' INVALID_ARGUMENT = 'invalidArgument'
INVALID_MEMBER = 'invalidMember' INVALID_MEMBER = 'invalidMember'
@ -199,6 +204,8 @@ ERROR_REASON_TO_EXCEPTION = {
GapiGatewayTimeoutError, GapiGatewayTimeoutError,
ErrorReason.GROUP_NOT_FOUND: ErrorReason.GROUP_NOT_FOUND:
GapiGroupNotFoundError, GapiGroupNotFoundError,
ErrorReason.INTERNAL_SERVER_ERROR:
GapiInternalServerError,
ErrorReason.INVALID: ErrorReason.INVALID:
GapiInvalidError, GapiInvalidError,
ErrorReason.INVALID_ARGUMENT: ErrorReason.INVALID_ARGUMENT:
@ -336,6 +343,10 @@ def get_gapi_error_detail(e,
if 'Requested entity was not found' in message or 'does not exist' in message: if 'Requested entity was not found' in message or 'does not exist' in message:
error = _create_http_error_dict(404, ErrorReason.NOT_FOUND.value, error = _create_http_error_dict(404, ErrorReason.NOT_FOUND.value,
message) message)
elif http_status == 500:
if 'Failed to convert server response to JSON' in message:
error = _create_http_error_dict(500, ErrorReason.INTERNAL_SERVER_ERROR.value,
message)
else: else:
if 'error_description' in error: if 'error_description' in error:
if error['error_description'] == 'Invalid Value': if error['error_description'] == 'Invalid Value':

View File

@ -8,7 +8,7 @@ import platform
import re import re
GAM_AUTHOR = 'Jay Lee <jay0lee@gmail.com>' GAM_AUTHOR = 'Jay Lee <jay0lee@gmail.com>'
GAM_VERSION = '6.08' GAM_VERSION = '6.09'
GAM_LICENSE = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' GAM_LICENSE = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
GAM_URL = 'https://git.io/gam' GAM_URL = 'https://git.io/gam'