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 2023/03/13 03:50:46 UTC

[iotdb] branch master updated: Python client should throw exception when meets error (#9301)

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 afa24f2f4a Python client should throw exception when meets error (#9301)
afa24f2f4a is described below

commit afa24f2f4a2480b4c6c5995433a351128e9165c0
Author: Haonan <hh...@outlook.com>
AuthorDate: Mon Mar 13 11:50:39 2023 +0800

    Python client should throw exception when meets error (#9301)
---
 client-py/iotdb/Session.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/client-py/iotdb/Session.py b/client-py/iotdb/Session.py
index c32ecc8b34..1a4c41326d 100644
--- a/client-py/iotdb/Session.py
+++ b/client-py/iotdb/Session.py
@@ -1054,7 +1054,9 @@ class Session(object):
             return 0
 
         logger.error("error status is %s", status)
-        return -1
+        raise RuntimeError(
+            "execution of statement fails because: " + status.message
+        )
 
     def execute_raw_data_query(
         self, paths: list, start_time: int, end_time: int
@@ -1258,7 +1260,7 @@ class Session(object):
                     return None
             else:
                 raise RuntimeError(
-                    "execution of statement fails because: {}", status.message
+                    "execution of statement fails because: " + status.message
                 )
         except TTransport.TException as e:
             raise RuntimeError("execution of statement fails because: ", e)