(20241127) Labels upgraded.
This commit is contained in:
+11
-5
@@ -165,7 +165,13 @@ class AsyncGoogleBase:
|
||||
# ┛
|
||||
|
||||
@staticmethod
|
||||
async def get_error_message(api_response: GoogleApiResponse):
|
||||
async def __get_error_message(api_response: GoogleApiResponse) -> str:
|
||||
|
||||
"""
|
||||
To extract various kinds of error messages from Google's responses.
|
||||
:param api_response: The formatted response from the API call.
|
||||
:return: The message string.
|
||||
"""
|
||||
|
||||
try: return (await api_response.get_json())["error"]["message"]
|
||||
except: return api_response.response.reason_phrase
|
||||
@@ -210,7 +216,7 @@ class AsyncGoogleBase:
|
||||
# Note down the results:
|
||||
api_response.response = response
|
||||
api_response.httpCode = response.status_code
|
||||
api_response.message = await self.get_error_message(api_response)
|
||||
api_response.message = await self.__get_error_message(api_response)
|
||||
|
||||
# If something goes wrong:
|
||||
except Exception as exception:
|
||||
@@ -259,7 +265,7 @@ class AsyncGoogleBase:
|
||||
# Note down the results:
|
||||
api_response.response = response
|
||||
api_response.httpCode = response.status_code
|
||||
api_response.message = await self.get_error_message(api_response)
|
||||
api_response.message = await self.__get_error_message(api_response)
|
||||
|
||||
# If something goes wrong:
|
||||
except Exception as exception:
|
||||
@@ -308,7 +314,7 @@ class AsyncGoogleBase:
|
||||
# Note down the results:
|
||||
api_response.response = response
|
||||
api_response.httpCode = response.status_code
|
||||
api_response.message = await self.get_error_message(api_response)
|
||||
api_response.message = await self.__get_error_message(api_response)
|
||||
|
||||
# If something goes wrong:
|
||||
except Exception as exception:
|
||||
@@ -351,7 +357,7 @@ class AsyncGoogleBase:
|
||||
# Note down the results:
|
||||
api_response.response = response
|
||||
api_response.httpCode = response.status_code
|
||||
api_response.message = await self.get_error_message(api_response)
|
||||
api_response.message = await self.__get_error_message(api_response)
|
||||
|
||||
# If something goes wrong:
|
||||
except Exception as exception:
|
||||
|
||||
Reference in New Issue
Block a user