errors: Separate browser error reporting from backend.

This commit is contained in:
Tim Abbott 2017-01-23 22:54:18 -08:00
parent ddf17abf5c
commit 0dd5d6cea0
4 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,7 @@ from __future__ import print_function
from typing import Any, Callable, Iterable, Tuple
from django.test import override_settings
from zerver.lib.test_classes import (
ZulipTestCase,
)
@ -107,6 +108,7 @@ class TestReport(ZulipTestCase):
]
self.assertEqual(stats_mock.func_calls, expected_calls)
@override_settings(BROWSER_ERROR_REPORTING=True)
def test_report_error(self):
# type: () -> None
email = 'hamlet@zulip.com'
@ -138,6 +140,6 @@ class TestReport(ZulipTestCase):
self.assertEqual(report['more_info'], dict(foo='bar'))
self.assertEqual(report['user_email'], email)
with self.settings(ERROR_REPORTING=False):
with self.settings(BROWSER_ERROR_REPORTING=False):
result = self.client_post("/json/report_error", params)
self.assert_json_success(result)

View File

@ -82,7 +82,7 @@ def json_report_error(request, user_profile, message=REQ(), stacktrace=REQ(),
# type: (HttpRequest, UserProfile, Text, Text, bool, Text, Text, Text, Dict[str, Any]) -> HttpResponse
"""Accepts an error report and stores in a queue for processing. The
actual error reports are later handled by do_report_error (below)"""
if not settings.ERROR_REPORTING:
if not settings.BROWSER_ERROR_REPORTING:
return json_success()
if js_source_map:

View File

@ -135,11 +135,11 @@ ENABLE_FEEDBACK = False
# be sent to that email address.
FEEDBACK_EMAIL = ZULIP_ADMINISTRATOR
# Controls whether or not error reports are sent to Zulip. Error
# reports are used to improve the quality of the product and do not
# include message contents; please contact Zulip support with any
# questions.
ERROR_REPORTING = True
# Controls whether or not error reports (tracebacks) are emailed to the
# server administrators.
#ERROR_REPORTING = True
# For frontend (JavaScript) tracebacks
#BROWSER_ERROR_REPORTING = False
# Controls whether or not Zulip will provide inline image preview when
# a link to an image is referenced in a message.

View File

@ -113,6 +113,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
'LOCAL_UPLOADS_DIR': None,
'MAX_FILE_UPLOAD_SIZE': 25,
'ERROR_REPORTING': True,
'BROWSER_ERROR_REPORTING': False,
'STAGING_ERROR_NOTIFICATIONS': False,
'EVENT_LOGS_ENABLED': False,
'SAVE_FRONTEND_STACKTRACES': False,