Skip to content

Commit

Permalink
Added error handling to PRC logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikey committed Dec 30, 2024
1 parent fb6e53d commit 14d7590
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tasks/iterate_prc_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import logging
import asyncio
import datetime
from utils.utils import fetch_get_channel

from sentry_sdk import push_scope, capture_exception

from utils.utils import fetch_get_channel, error_gen
from utils import prc_api
from utils.constants import BLANK_COLOR, GREEN_COLOR, RED_COLOR

Expand Down Expand Up @@ -130,7 +133,13 @@ async def process_guild(items):
await asyncio.gather(*subtasks, return_exceptions=True)

except Exception as e:
logging.error(f"Error processing guild {items['_id']}: {e}")
error_id = error_gen()
with push_scope() as scope:
scope.set_tag("error_id", error_id)
scope.level = "error"

capture_exception(e)
logging.error(f"Error processing guild {items['_id']}: {error_id}")

async for items in bot.settings.db.aggregate(pipeline):
tasks.append(process_guild(items))
Expand Down

0 comments on commit 14d7590

Please sign in to comment.