noidname01 commented on code in PR #4093:
URL: https://github.com/apache/gravitino/pull/4093#discussion_r1670071789


##########
clients/client-python/gravitino/utils/http_client.py:
##########
@@ -154,19 +177,38 @@ def _request(
                 self.auth_data_provider.get_token_data().decode("utf-8"),
             )
         request.get_method = lambda: method
-        return Response(self._make_request(opener, request, timeout=timeout))
-
-    def get(self, endpoint, params=None, **kwargs):
-        return self._request("get", endpoint, params=params, **kwargs)
-
-    def delete(self, endpoint, **kwargs):
-        return self._request("delete", endpoint, **kwargs)
-
-    def post(self, endpoint, json=None, **kwargs):
-        return self._request("post", endpoint, json=json, **kwargs)
-
-    def put(self, endpoint, json=None, **kwargs):
-        return self._request("put", endpoint, json=json, **kwargs)
+        is_success, resp = self._make_request(opener, request, timeout=timeout)
+
+        if is_success:
+            return resp
+
+        if not isinstance(error_handler, ErrorHandler):
+            raise UnknownError(
+                f"Unknown error handler {type(error_handler).__name__}, error 
response body: {resp}"
+            ) from None
+
+        error_handler.handle(resp)
+        raise UnknownError(
+            f"Error handler {type(error_handler).__name__} can't handle this 
response, error response body: {resp}"
+        ) from None

Review Comment:
   Yeah you're right, I add this because `pylint` doesn't let me to just put 
the `error_handler.handle(resp)` without return or raise, I think it can't 
analyze that the handler would raise exception anyway. I should add comment for 
it.
   
   But on the other hand, maybe one error handler don't want to define the 
default behavior, this can be the final line of defense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to