Skip to content

Commit

Permalink
工单详情增加审核结果解析IndexError异常的处理
Browse files Browse the repository at this point in the history
增加查询脱敏失败的日志记录
  • Loading branch information
hhyo committed Jun 22, 2019
1 parent e7b5f1b commit 794c982
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sql/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ def query(request):
query_result.error = None
priv_check = False
result['data'] = query_result.__dict__
logger.error(f'数据脱敏异常,查询语句:{sql_content}\n,错误信息:{masking_result.error}')
# 正常脱敏
else:
result['data'] = masking_result.__dict__
else:
logger.error(f'数据脱敏异常,查询语句:{sql_content}\n,错误信息:{traceback.format_exc()}')
logger.error(f'数据脱敏异常,查询语句:{sql_content}\n,错误信息:{query_masking_task.result}')
# 抛出未定义异常,并且开启query_check,直接返回异常,禁止执行
if config.get('query_check'):
result['status'] = 1
Expand Down
6 changes: 6 additions & 0 deletions sql/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ def detail(request, workflow_id):
for r in loaded_rows:
review_result.rows += [ReviewResult(inception_result=r)]
rows = review_result.json()
except IndexError:
review_result.rows += [ReviewResult(
errormessage="Json decode failed."
"执行结果Json解析失败, 请联系管理员"
)]
rows = review_result.json()
except json.decoder.JSONDecodeError:
review_result.rows += [ReviewResult(
# 迫于无法单元测试这里加上英文报错信息
Expand Down

0 comments on commit 794c982

Please sign in to comment.