decorator: Drop the stack_info on most WebhookErrors.

`stack_info` shows the stack between where the error was raised and
where it was captured -- which is not interesting when we
intentionally raised it, and know where it will be captured.

Omit the `stack_info` when it will just fill the logs with
uninteresting data.
This commit is contained in:
Alex Vandiver
2023-10-11 18:51:41 +00:00
committed by Tim Abbott
parent 05d8c9d49e
commit 869f96e31b
2 changed files with 6 additions and 5 deletions

View File

@@ -312,10 +312,13 @@ def log_unsupported_webhook_event(request: HttpRequest, summary: str) -> None:
def log_exception_to_webhook_logger(request: HttpRequest, err: Exception) -> None:
extra = {"request": request}
# We intentionally omit the stack_info for these events, where
# they are intentionally raised, and the stack_info between that
# point and this one is not interesting.
if isinstance(err, AnomalousWebhookPayloadError):
webhook_anomalous_payloads_logger.exception(err, stack_info=True, extra=extra)
webhook_anomalous_payloads_logger.exception(err, extra=extra)
elif isinstance(err, UnsupportedWebhookEventTypeError):
webhook_unsupported_events_logger.exception(err, stack_info=True, extra=extra)
webhook_unsupported_events_logger.exception(err, extra=extra)
else:
webhook_logger.exception(err, stack_info=True, extra=extra)