Skip to content

Commit

Permalink
兼容某些异常场景下语法树解析返回格式为审核结果的问题 fix hhyo#1826
Browse files Browse the repository at this point in the history
(cherry picked from commit b5bab4e)
  • Loading branch information
hhyo authored and nick2wang committed Nov 8, 2022
1 parent 4deb4d0 commit 7edbb42
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sql/engines/goinception.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,14 @@ def query_data_masking(self, instance, db_name=None, sql=""):
raise RuntimeError(f"Inception Error: {query_result.error}")
if not query_result.rows:
raise RuntimeError(f"Inception Error: 未获取到语法信息")
# 兼容语法错误时errlevel=0的场景
# 兼容某些异常场景下返回内容为审核结果的问题 https://github.com/hhyo/Archery/issues/1826
print_info = query_result.to_dict()[0]
if print_info["errlevel"] == 0 and print_info["errmsg"] is None:
if "error_level" in print_info:
raise RuntimeError(f'Inception Error: {print_info.get("error_message")}')
if print_info.get("errlevel") == 0 and print_info.get("errmsg") is None:
return json.loads(print_info["query_tree"])
else:
raise RuntimeError(f"Inception Error: {print_info['errmsg']}")
raise RuntimeError(f'Inception Error: print_info.get("errmsg")')

def get_rollback(self, workflow):
"""
Expand Down

0 comments on commit 7edbb42

Please sign in to comment.