mirror of https://github.com/zulip/zulip.git
Automatically decode JavaScript stack traces as we send them
(imported from commit 348c464102a43a44c91c79d498cd33e6405ed670)
This commit is contained in:
parent
1ecc063d0f
commit
7236c63008
|
@ -42,6 +42,7 @@ from zephyr.lib.avatar import gravatar_hash
|
||||||
from zephyr.lib.response import json_success, json_error, json_response, json_method_not_allowed
|
from zephyr.lib.response import json_success, json_error, json_response, json_method_not_allowed
|
||||||
from zephyr.lib.timestamp import timestamp_to_datetime, datetime_to_timestamp
|
from zephyr.lib.timestamp import timestamp_to_datetime, datetime_to_timestamp
|
||||||
from zephyr.lib.cache import cache_with_key
|
from zephyr.lib.cache import cache_with_key
|
||||||
|
from zephyr.lib.unminify import SourceMap
|
||||||
|
|
||||||
from zephyr import tornado_callbacks
|
from zephyr import tornado_callbacks
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ import time
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
|
from os import path
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from zephyr.lib import bugdown
|
from zephyr.lib import bugdown
|
||||||
|
|
||||||
|
@ -1374,6 +1376,10 @@ def json_update_active_status(request, user_profile,
|
||||||
def json_get_active_statuses(request, user_profile):
|
def json_get_active_statuses(request, user_profile):
|
||||||
return json_success(get_status_list(user_profile))
|
return json_success(get_status_list(user_profile))
|
||||||
|
|
||||||
|
# Read the source map information for decoding JavaScript backtraces
|
||||||
|
js_source_map = SourceMap(path.join(
|
||||||
|
settings.SITE_ROOT, '../prod-static/source-map/app.js.map'))
|
||||||
|
|
||||||
@authenticated_json_post_view
|
@authenticated_json_post_view
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def json_report_error(request, user_profile, message=POST, stacktrace=POST,
|
def json_report_error(request, user_profile, message=POST, stacktrace=POST,
|
||||||
|
@ -1384,6 +1390,8 @@ def json_report_error(request, user_profile, message=POST, stacktrace=POST,
|
||||||
else:
|
else:
|
||||||
subject = "Browser " + subject
|
subject = "Browser " + subject
|
||||||
|
|
||||||
|
stacktrace = js_source_map.annotate_stacktrace(stacktrace)
|
||||||
|
|
||||||
mail_admins(subject,
|
mail_admins(subject,
|
||||||
"Message:\n%s\n\nStacktrace:\n%s\n\nUser agent:\n%s\n\n"
|
"Message:\n%s\n\nStacktrace:\n%s\n\nUser agent:\n%s\n\n"
|
||||||
"User saw error in UI: %s"
|
"User saw error in UI: %s"
|
||||||
|
|
Loading…
Reference in New Issue