mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Don't re-raise exceptions that are 'handled in the UI'
we now have handling for them, no need to keep seeing them as stacktraces. also: in the EAGER setup, raising means the transaciton is rolled back, and nothing is stored in the DB at all. if we ever want to 'get more info' something like capture_or_log_exception would be more apt
This commit is contained in:
@@ -131,11 +131,9 @@ def slack_backend_send_test_message(webhook_url, project_name, display_name, ser
|
||||
except requests.RequestException as e:
|
||||
response = getattr(e, 'response', None)
|
||||
_store_failure_info(service_config_id, e, response)
|
||||
raise
|
||||
|
||||
except Exception as e:
|
||||
_store_failure_info(service_config_id, e)
|
||||
raise
|
||||
|
||||
|
||||
@shared_task
|
||||
@@ -211,11 +209,9 @@ def slack_backend_send_alert(
|
||||
except requests.RequestException as e:
|
||||
response = getattr(e, 'response', None)
|
||||
_store_failure_info(service_config_id, e, response)
|
||||
raise
|
||||
|
||||
except Exception as e:
|
||||
_store_failure_info(service_config_id, e)
|
||||
raise
|
||||
|
||||
|
||||
class SlackBackend:
|
||||
|
||||
@@ -192,14 +192,13 @@ class TestSlackBackendErrorHandling(DjangoTestCase):
|
||||
|
||||
mock_post.return_value = mock_response
|
||||
|
||||
# Send test message and expect it to raise
|
||||
with self.assertRaises(requests.HTTPError):
|
||||
slack_backend_send_test_message(
|
||||
"https://hooks.slack.com/test",
|
||||
"Test project",
|
||||
"Test Slack",
|
||||
self.config.id
|
||||
)
|
||||
# Send test message
|
||||
slack_backend_send_test_message(
|
||||
"https://hooks.slack.com/test",
|
||||
"Test project",
|
||||
"Test Slack",
|
||||
self.config.id
|
||||
)
|
||||
|
||||
# Verify failure status was stored
|
||||
self.config.refresh_from_db()
|
||||
@@ -224,13 +223,12 @@ class TestSlackBackendErrorHandling(DjangoTestCase):
|
||||
mock_post.return_value = mock_response
|
||||
|
||||
# Send test message and expect it to raise
|
||||
with self.assertRaises(requests.HTTPError):
|
||||
slack_backend_send_test_message(
|
||||
"https://hooks.slack.com/test",
|
||||
"Test project",
|
||||
"Test Slack",
|
||||
self.config.id
|
||||
)
|
||||
slack_backend_send_test_message(
|
||||
"https://hooks.slack.com/test",
|
||||
"Test project",
|
||||
"Test Slack",
|
||||
self.config.id
|
||||
)
|
||||
|
||||
# Verify failure status was stored
|
||||
self.config.refresh_from_db()
|
||||
@@ -244,14 +242,13 @@ class TestSlackBackendErrorHandling(DjangoTestCase):
|
||||
# Mock connection error
|
||||
mock_post.side_effect = requests.ConnectionError("Connection failed")
|
||||
|
||||
# Send test message and expect it to raise
|
||||
with self.assertRaises(requests.ConnectionError):
|
||||
slack_backend_send_test_message(
|
||||
"https://hooks.slack.com/test",
|
||||
"Test project",
|
||||
"Test Slack",
|
||||
self.config.id
|
||||
)
|
||||
# Send test message
|
||||
slack_backend_send_test_message(
|
||||
"https://hooks.slack.com/test",
|
||||
"Test project",
|
||||
"Test Slack",
|
||||
self.config.id
|
||||
)
|
||||
|
||||
# Verify failure status was stored
|
||||
self.config.refresh_from_db()
|
||||
|
||||
Reference in New Issue
Block a user