Skip to content

feat(discord): adds logging of discord errors #58176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/sentry/integrations/discord/webhooks/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import logging

from django.views.decorators.csrf import csrf_exempt
from rest_framework.request import Request
from rest_framework.response import Response
Expand All @@ -14,6 +16,8 @@

from .types import DiscordResponseTypes

logger = logging.getLogger(__name__)


@region_silo_endpoint
class DiscordInteractionsEndpoint(Endpoint):
Expand Down Expand Up @@ -60,6 +64,13 @@ def post(self, request: Request) -> Response:
return DiscordMessageComponentHandler(discord_request).handle()

except DiscordRequestError as e:
logger.error(
"discord.request.error",
extra={
"error": str(e),
"status": e.status,
},
)
return self.respond(status=e.status)

# This isn't an interaction type that we need to worry about, so we'll
Expand Down