You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/09/20 01:59:40 UTC

[iotdb] branch master updated: [IOTDB-2519] Do not print stack when meeting sql error (#7255)

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 3759dcaf37 [IOTDB-2519] Do not print stack when meeting sql error (#7255)
3759dcaf37 is described below

commit 3759dcaf370d5f75eb9e3e43ca8ed9452190a1ec
Author: Yang Cheng <ch...@163.com>
AuthorDate: Tue Sep 20 09:59:34 2022 +0800

    [IOTDB-2519] Do not print stack when meeting sql error (#7255)
---
 .../java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
index f45a09fca7..f2aaf0a841 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
@@ -81,8 +81,14 @@ public class ErrorHandlingUtils {
     if (status != null) {
       // ignore logging sg not ready exception
       if (status.getCode() != TSStatusCode.STORAGE_GROUP_NOT_READY.getStatusCode()) {
-        LOGGER.error(
-            "Status code: " + status.getCode() + ", Query Statement: " + operation + " failed", e);
+        String message =
+            String.format(
+                "Status code: %s, Query Statement: %s failed", status.getCode(), operation);
+        if (status.getCode() == TSStatusCode.SQL_PARSE_ERROR.getStatusCode()) {
+          LOGGER.error(message);
+        } else {
+          LOGGER.error(message, e);
+        }
       }
       return status;
     } else {