Skip to content

Commit bc8c79f

Browse files
authored
Merge pull request #43 from arpitjain099/alert-autofix-24
Fix code scanning alert no. 24: Information exposure through an exception
2 parents 00027f8 + f6456ee commit bc8c79f

File tree

1 file changed

+4
-4
lines changed
  • End_to_end_Solutions/AOAISearchDemo/app/backend

1 file changed

+4
-4
lines changed

End_to_end_Solutions/AOAISearchDemo/app/backend/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def chat():
340340
return jsonify(response.to_item()), 400
341341
except Exception as e:
342342
logger.exception(f"Exception in /chat: {e}", extra=properties)
343-
response = ChatResponse(answer=Answer(), error=str(e), show_retry=True)
343+
response = ChatResponse(answer=Answer(), error="An internal error has occurred.", show_retry=True)
344344
return jsonify(response.to_item()), 500
345345

346346

@@ -352,7 +352,7 @@ def get_all_user_profiles():
352352
return jsonify(user_profiles_dict)
353353
except Exception as e:
354354
logger.exception(f"Exception in /user-profiles: {e}")
355-
return jsonify({"error": "An internal error has occurred!"}), 500
355+
return jsonify({"error": "An internal error has occurred."}), 500
356356

357357

358358
@app.route("/chat-sessions/<user_id>/<conversation_id>", methods=["DELETE"])
@@ -369,7 +369,7 @@ def clear_chat_session(user_id: str, conversation_id: str):
369369
logger.exception(
370370
f"Exception in /chat-sessions/<user_id>/<conversation_id>: {e}"
371371
)
372-
return jsonify({"error": "An internal error has occurred!"}), 500
372+
return jsonify({"error": "An internal error has occurred."}), 500
373373

374374

375375
@app.route("/search-settings", methods=["GET"])
@@ -391,7 +391,7 @@ def get_search_settings():
391391
return jsonify(search_settings.to_item())
392392
except Exception as e:
393393
logger.exception(f"Exception in /search-settings: {e}")
394-
return jsonify({"error": "An internal error has occurred!"}), 500
394+
return jsonify({"error": "An internal error has occurred."}), 500
395395

396396

397397
if __name__ == "__main__":

0 commit comments

Comments
 (0)