Skip to content

Commit d1df273

Browse files
Potential fix for code scanning alert no. 2: Information exposure through an exception
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 8f1ecd0 commit d1df273

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • zava-creative-writer-local/src/api/agents/writer

‎zava-creative-writer-local/src/api/agents/writer/writer.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import sys
99
from pathlib import Path
10+
import logging
1011

1112
# Add api root to path so we can import foundry_config
1213
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
@@ -63,8 +64,10 @@ def write(researchContext, research, productContext, products, assignment, feedb
6364
for chunk in stream:
6465
if chunk.choices[0].delta.content is not None:
6566
yield chunk.choices[0].delta.content
66-
except Exception as e:
67-
yield f"An exception occurred: {e}"
67+
except Exception:
68+
# Log full exception details server-side, but return a generic message to the user.
69+
logging.exception("Writer agent encountered an error while generating the article.")
70+
yield "An internal error occurred while generating the article."
6871

6972

7073
def process(writer_output):

0 commit comments

Comments
 (0)