Skip to content

Commit e662fcf

Browse files
committed
LCORE-463: added missing error handling
1 parent da067bc commit e662fcf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/app/endpoints/feedback.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ def store_feedback(user_id: str, feedback: dict) -> None:
145145

146146
# stores feedback in a file under unique uuid
147147
feedback_file_path = storage_path / f"{get_suid()}.json"
148-
with open(feedback_file_path, "w", encoding="utf-8") as feedback_file:
149-
json.dump(data_to_store, feedback_file)
148+
try:
149+
with open(feedback_file_path, "w", encoding="utf-8") as feedback_file:
150+
json.dump(data_to_store, feedback_file)
151+
except (OSError, IOError) as e:
152+
logger.error("Failed to store feedback at %s: %s", feedback_file_path, e)
153+
raise
150154

151155
logger.info("Feedback stored successfully at %s", feedback_file_path)
152156

0 commit comments

Comments
 (0)