jerryshao commented on code in PR #7829:
URL: https://github.com/apache/gravitino/pull/7829#discussion_r2281191182
##########
server/src/main/java/org/apache/gravitino/server/web/rest/ExceptionHandlers.java:
##########
@@ -906,6 +911,34 @@ public Response handle(OperationType op, String
jobTemplate, String parent, Exce
}
}
+ private static class StatisticExceptionHandler extends BaseExceptionHandler {
+
+ private static final ExceptionHandler INSTANCE = new
StatisticExceptionHandler();
+
+ private static String getStatisticErrorMsg(
+ String name, String operation, String parent, String reason) {
+ return String.format(
+ "Failed to operate statistic(s)%s operation [%s] on parent [%s],
reason [%s]",
+ name, operation, parent, reason);
+ }
+
+ @Override
+ public Response handle(OperationType op, String name, String object,
Exception e) {
+ String formatted = StringUtil.isBlank(name) ? "" : " [" + name + "]";
+ String errorMsg = getStatisticErrorMsg(formatted, op.name(), object,
getErrorMsg(e));
+ LOG.warn(errorMsg, e);
+
+ if (e instanceof IllegalArgumentException) {
+ return Utils.illegalArguments(errorMsg, e);
+
Review Comment:
Return this empty line.
--
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]