Skip to content
Snippets Groups Projects
Commit c3380766 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Enable sentry user feedback for crash reports

parent 55de6d6b
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ import rq_dashboard ...@@ -15,6 +15,7 @@ import rq_dashboard
from flask import Blueprint, render_template, jsonify, g, current_app, abort from flask import Blueprint, render_template, jsonify, g, current_app, abort
from flask_login import login_required, current_user from flask_login import login_required, current_user
from rq import push_connection, pop_connection from rq import push_connection, pop_connection
from ..extensions import sentry
from .. import utils from .. import utils
bp = Blueprint("main", __name__) bp = Blueprint("main", __name__)
...@@ -41,7 +42,13 @@ def not_found_error(error): ...@@ -41,7 +42,13 @@ def not_found_error(error):
@bp.app_errorhandler(500) @bp.app_errorhandler(500)
def internal_error(error): def internal_error(error):
return render_template("500.html"), 500 if current_app.config["SENTRY_DSN"]:
event_id = g.sentry_event_id
public_dsn = sentry.client.get_public_dsn("https")
else:
event_id = ""
public_dsn = ""
return render_template("500.html", event_id=event_id, public_dsn=public_dsn), 500
@bp.app_errorhandler(utils.CSEntryError) @bp.app_errorhandler(utils.CSEntryError)
......
This diff is collapsed.
...@@ -5,3 +5,15 @@ ...@@ -5,3 +5,15 @@
{% block main %} {% block main %}
<h1>Internal Server Error</h1> <h1>Internal Server Error</h1>
{%- endblock %} {%- endblock %}
{% block csentry_scripts %}
<script src="{{ url_for('static', filename='js/raven.min.js') }}"></script>
{% if event_id %}
<script>
Raven.showReportDialog({
eventId: '{{ event_id }}',
dsn: '{{ public_dsn }}'
});
</script>
{% endif %}
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment