Skip to content

Commit

Permalink
Remove error handling test and let honeybadger deal with it
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Jun 11, 2024
1 parent bd4954e commit a5a90bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
5 changes: 3 additions & 2 deletions chat/src/handlers/chat.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import boto3
import json
import logging
import os
from datetime import datetime
from event_config import EventConfig
from helpers.response import prepare_response
from honeybadger import honeybadger

if not os.getenv("HONEYBADGER_DISABLED") == "true":
honeybadger.configure()
honeybadger.configure()
logging.getLogger('honeybadger').addHandler(logging.StreamHandler())

RESPONSE_TYPES = {
"base": ["answer", "ref"],
Expand Down
14 changes: 0 additions & 14 deletions chat/test/handlers/test_chat.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# ruff: noqa: E402

import contextlib
from io import StringIO
import json
import os
import sys
Expand Down Expand Up @@ -71,15 +69,3 @@ def test_handler_debug_mode_for_superusers_only(self, mock_is_debug_enabled, moc
handler(event, MockContext())
response = json.loads(mock_client.received_data)
self.assertEqual(response["type"], "error")

@patch.object(EventConfig, 'setup_websocket')
def test_error_handling(self, mock_event):
mock_event.side_effect = Exception("Some error occurred")
capture = StringIO()
with contextlib.redirect_stdout(capture):
response = handler({}, {})
self.assertEqual(response['statusCode'], 500)
self.assertIn('Unhandled error:', response['body'])
self.assertIn('Exception: Some error occurred', response['body'])
self.assertIn('Exception: Some error occurred', capture.getvalue())

0 comments on commit a5a90bc

Please sign in to comment.