Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

decorator: Drop the stack_info on most WebhookErrors.

Alex Vandiver869f96e31be0
diff --git a/zerver/decorator.py b/zerver/decorator.py
index abb2e209d74..3074d194292 100644
--- a/zerver/decorator.py
+++ b/zerver/decorator.py
@@ -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)
diff --git a/zerver/tests/test_decorators.py b/zerver/tests/test_decorators.py
index 5a2cdcd9cad..d81d7070163 100644
--- a/zerver/tests/test_decorators.py
+++ b/zerver/tests/test_decorators.py
@@ -418,9 +418,7 @@ class DecoratorLoggingTestCase(ZulipTestCase):
self.assertIsInstance(mock_exception.call_args.args[0], UnsupportedWebhookEventTypeError)
self.assertEqual(mock_exception.call_args.args[0].event_type, "test_event")
self.assertEqual(mock_exception.call_args.args[0].msg, exception_msg)
- self.assertEqual(
- mock_exception.call_args.kwargs, {"stack_info": True, "extra": {"request": request}}
- )
+ self.assertEqual(mock_exception.call_args.kwargs, {"extra": {"request": request}})
def test_authenticated_rest_api_view_with_non_webhook_view(self) -> None:
@authenticated_rest_api_view()