diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 99a601d9..4cf40b34 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -7244,6 +7244,7 @@ def enableGAMProjectAPIs(GAMProjectAPIs, gapi_errors.ErrorReason.FORBIDDEN, gapi_errors.ErrorReason.PERMISSION_DENIED ], + retry_reasons=[gapi_errors.ErrorReason.INTERNAL_SERVER_ERROR], name=service_name) print(f' API: {api}, Enabled{currentCount(j, jcount)}') break diff --git a/src/gam/gapi/errors.py b/src/gam/gapi/errors.py index 1b7c71b2..efff746f 100644 --- a/src/gam/gapi/errors.py +++ b/src/gam/gapi/errors.py @@ -60,6 +60,10 @@ class GapiGroupNotFoundError(Exception): pass +class GapiInternalServerError(Exception): + pass + + class GapiInvalidError(Exception): pass @@ -125,6 +129,7 @@ class ErrorReason(Enum): GATEWAY_TIMEOUT = 'gatewayTimeout' GROUP_NOT_FOUND = 'groupNotFound' INTERNAL_ERROR = 'internalError' + INTERNAL_SERVER_ERROR = 'internalServerError' INVALID = 'invalid' INVALID_ARGUMENT = 'invalidArgument' INVALID_MEMBER = 'invalidMember' @@ -199,6 +204,8 @@ ERROR_REASON_TO_EXCEPTION = { GapiGatewayTimeoutError, ErrorReason.GROUP_NOT_FOUND: GapiGroupNotFoundError, + ErrorReason.INTERNAL_SERVER_ERROR: + GapiInternalServerError, ErrorReason.INVALID: GapiInvalidError, 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: error = _create_http_error_dict(404, ErrorReason.NOT_FOUND.value, 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: if 'error_description' in error: if error['error_description'] == 'Invalid Value': diff --git a/src/gam/var.py b/src/gam/var.py index 4b4f3b5d..8727b865 100644 --- a/src/gam/var.py +++ b/src/gam/var.py @@ -8,7 +8,7 @@ import platform import re GAM_AUTHOR = 'Jay Lee ' -GAM_VERSION = '6.08' +GAM_VERSION = '6.09' GAM_LICENSE = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' GAM_URL = 'https://git.io/gam'