Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjiaqi authored and yinjiaqi committed Dec 27, 2024
1 parent 1d6f3f3 commit 4580ed7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions python/core/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.


"""Base client for interact with backend server"""

import os
Expand Down Expand Up @@ -260,30 +259,30 @@ async def check_response_header(response: ClientResponse):
"""
status_code = response.status
if status_code == requests.codes.ok:
await logger.debug("request_id={} , http status code is {} , response text is {}".format(
logger.debug("request_id={} , http status code is {} , response text is {}".format(
await __class__.response_request_id(response), status_code, await response.text()
))
return
message = "request_id={} , http status code is {}, body is {}".format(
await __class__.response_request_id(response), status_code, await response.text()
)
if status_code == requests.codes.bad_request:
await logger.error(message)
logger.error(message)
raise BadRequestException(message)
elif status_code == requests.codes.forbidden:
await logger.error(message)
logger.error(message)
raise ForbiddenException(message)
elif status_code == requests.codes.not_found:
await logger.error(message)
logger.error(message)
raise NotFoundException(message)
elif status_code == requests.codes.precondition_required:
await logger.error(message)
logger.error(message)
raise PreconditionFailedException(message)
elif status_code == requests.codes.internal_server_error:
await logger.error(message)
logger.error(message)
raise InternalServerErrorException(message)
else:
await logger.error(message)
logger.error(message)
raise BaseRPCException(message)

@staticmethod
Expand Down

0 comments on commit 4580ed7

Please sign in to comment.