Skip to content

Commit

Permalink
better error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Feb 22, 2024
1 parent ca5fd2b commit 111a0e6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions py/pyaici/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ def run_controller(
if w:
storage[w["name"]] = w["value"]
err = ch.get("error", "")
if err:
res["error"] = err
print(f"*** Error in [{idx}]: {err}")
if log_level > 2:
l = ch["logs"].rstrip("\n")
if l:
Expand All @@ -241,6 +238,12 @@ def run_controller(
elif log_level > 0:
print(ch["text"], end="")
sys.stdout.flush()
if err:
res["error"] = err
if log_level > 2 and err in ch["logs"]:
print(f"*** Error in [{idx}]")
else:
print(f"*** Error in [{idx}]: {err}")
logs[idx] += ch["logs"]
texts[idx] += ch["text"]
elif decoded_line == "data: [DONE]":
Expand Down

0 comments on commit 111a0e6

Please sign in to comment.