Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Flexible error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
lmangani committed Nov 12, 2023
1 parent b6be866 commit 9eacecd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def play():
query = query.encode('utf-8')

if body is not None:
# temporary hack to flatten multilines. to be replaced with raw `--file` input
data = f""
request_lines = body.decode('utf-8').strip().splitlines(True)
for line in request_lines:
Expand All @@ -92,6 +93,9 @@ def play():
result, errmsg = chdb_query_with_errmsg(query.strip(), format)
if len(errmsg) == 0:
return result, 200
if len(result) > 0:
print("warning:", errmsg)
return result, 200
return errmsg, 400


Expand Down

0 comments on commit 9eacecd

Please sign in to comment.