From 7f5ecd4af19fca6d70e3fd782443ba9c91393f4f Mon Sep 17 00:00:00 2001 From: extreme4all <> Date: Tue, 9 Jan 2024 21:18:36 +0100 Subject: [PATCH] less error spam --- src/api/v1/report.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/v1/report.py b/src/api/v1/report.py index d1b8500..1b046d8 100644 --- a/src/api/v1/report.py +++ b/src/api/v1/report.py @@ -200,6 +200,8 @@ async def update_reports( return {"detail": f"{data.rowcount} rows updated to reportingID = {new_user_id}."} async def insert_active_reporter(reporter: str): + if 'anonymoususer' in reporter: + return try: sql: Text = text("INSERT INTO activeReporters (name) VALUES (:reporter)") @@ -208,6 +210,9 @@ async def insert_active_reporter(reporter: str): async with session.begin(): await session.execute(sql, {"reporter": reporter}) except Exception as e: + e = str(e) + if 'Duplicate entry' in e: + return logger.error(str(e))