gortiz commented on code in PR #15037:
URL: https://github.com/apache/pinot/pull/15037#discussion_r1975530174


##########
pinot-common/src/main/java/org/apache/pinot/common/datablock/DataBlockUtils.java:
##########
@@ -97,18 +98,22 @@ private DataBlockUtils() {
 
   public static MetadataBlock getErrorDataBlock(Exception e) {
     if (e instanceof ProcessingException) {
-      return getErrorDataBlock(Collections.singletonMap(((ProcessingException) 
e).getErrorCode(), extractErrorMsg(e)));
+      int errorCodeId = ((ProcessingException) e).getErrorCode();
+      return getErrorDataBlock(Collections.singletonMap(errorCodeId, 
extractErrorMsg(e)));
+    } else if (e instanceof QueryException) {
+      int errorCodeId = ((QueryException) e).getErrorCode().getId();
+      return getErrorDataBlock(Collections.singletonMap(errorCodeId, 
extractErrorMsg(e)));
     } else {
       // TODO: Pass in meaningful error code.
-      return 
getErrorDataBlock(Collections.singletonMap(QueryException.UNKNOWN_ERROR_CODE, 
extractErrorMsg(e)));
+      return getErrorDataBlock(Map.of(QueryErrorCode.UNKNOWN.getId(), 
extractErrorMsg(e)));
     }
   }
 
   private static String extractErrorMsg(Throwable t) {
-    while (t.getCause() != null && t.getMessage() == null) {
-      t = t.getCause();
+    if (t.getMessage() != null) {
+      return t.getMessage();
     }
-    return t.getMessage() + "\n" + QueryException.getTruncatedStackTrace(t);
+    return "empty error message";

Review Comment:
   Lets also keep the stack trace for a while until the next PR where we 
actually clean up the logs and the error messages



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to