Copilot commented on code in PR #11959:
URL: https://github.com/apache/gravitino/pull/11959#discussion_r3562718103
##########
server/src/main/java/org/apache/gravitino/server/web/rest/ExceptionHandlers.java:
##########
@@ -1095,6 +1095,14 @@ public Response handle(OperationType op, String object,
String parent, Exception
String errorMsg =
getBaseErrorMsg(formattedObject, op.name(), formattedParent,
getErrorMsg(e));
+
+ // A backend a catalog federates to being unreachable is a
downstream-dependency failure, not
+ // an internal Gravitino error: surface it as 502 Bad Gateway so callers
can tell a dependency
+ // outage from a server bug.
+ if (e instanceof ConnectionFailedException) {
+ return Utils.connectionFailed(errorMsg, e);
+ }
Review Comment:
This `ConnectionFailedException` path returns 502 without logging anything,
while other exception paths are logged. That can make backend outage incidents
harder to debug from server logs (especially when this BaseExceptionHandler is
reached from handlers that don’t log before delegating). Consider logging at
least WARN before returning the 502 response.
##########
clients/client-java/src/main/java/org/apache/gravitino/client/ErrorHandlers.java:
##########
@@ -1374,6 +1374,9 @@ public ErrorResponse parseResponse(int code, String json,
ObjectMapper mapper) {
@Override
public void accept(ErrorResponse errorResponse) {
+ if (errorResponse.getCode() == ErrorConstants.CONNECTION_FAILED_CODE) {
+ throw new ConnectionFailedException("%s",
formatErrorMessage(errorResponse));
+ }
Review Comment:
`ConnectionFailedException` supports a plain message constructor; using a
format template of "%s" here is unnecessary and makes the intent slightly less
clear. Prefer passing the formatted message directly.
--
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]