Capture client javascript errors with sentry too

This commit is contained in:
Jeremy Zhang 2018-07-30 07:43:01 +00:00
parent c2bf983983
commit 5f8ecf03ed
5 changed files with 10 additions and 0 deletions

View File

@ -30,4 +30,5 @@ config = {
# Sentry.io is used to track and upload errors
"sentry-dsn": "Copy the dns string when creating a project on sentry",
"sentry-js-dsn": "Same as above, but you can create a seperate sentry project to track the client side js errors",
}

View File

@ -88,6 +88,7 @@ def before_first_request():
def context_processor():
return {
"devs": get_administrators_list(),
"sentry_js_dsn": config.get("sentry-js-dsn", None),
"constants": constants,
"af_mode_enabled": datetime.datetime.now().date() == datetime.date(datetime.datetime.now().year, 4, 1),
"dbl_voted": session.get("unauthenticated", True) == False and bool(redis_store.get("DiscordBotsOrgVoted/" + str(session.get("user_id", -1))))

View File

@ -336,6 +336,8 @@
<script src="{{ url_for('static', filename='js/vendor/emoji.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/wdt-emoji-bundle.min.js') }}"></script>
{% include 'sentry_js_init.html.j2' %}
{% raw %}
<script id="mustache_channellistings" type="text/template">
<li><a class="waves-effect truncate" id="channel-{{channelid}}"><span class="channel-hash">#</span> {{channelname}}</a></li>

View File

@ -0,0 +1,4 @@
<script src="https://cdn.ravenjs.com/3.26.2/raven.min.js" crossorigin="anonymous"></script>
<script>
Raven.config({{ sentry_js_dsn|tojson|safe }}).install();
</script>

View File

@ -93,6 +93,8 @@
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js" integrity="sha256-uWtSXRErwH9kdJTIr1swfHFJn/d/WQ6s72gELOHXQGM=" crossorigin="anonymous"></script>
{% include 'sentry_js_init.html.j2' %}
{% if not dbl_voted or (dbl_voted and request.path == "/") %}
<script>
$(document).ready(function () {