mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Merge branch 'sentry' into 'master'
Intégration d'une page d'incident automatique See merge request ae/Sith!165
This commit is contained in:
commit
6fd34bcaa0
3
core/static/core/js/sentry/bundle.min.js
vendored
Normal file
3
core/static/core/js/sentry/bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
19
core/templates/core/500.jinja
Normal file
19
core/templates/core/500.jinja
Normal file
@ -0,0 +1,19 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% if settings.EXTERNAL_RES %}
|
||||
<script src="https://browser.sentry-cdn.com/4.0.6/bundle.min.js" crossorigin="anonymous"></script>
|
||||
{% else %}
|
||||
<script src="{{ static('core/js/sentry/bundle.min.js') }}" crossorigin="anonymous"></script>
|
||||
{% endif %}
|
||||
{% endblock head %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans %}500, Server Error{% endtrans %}</h3>
|
||||
{% if settings.SENTRY_DSN %}
|
||||
<script>
|
||||
Sentry.init({ dsn: '{{ request.sentry_dsn }}' });
|
||||
Sentry.showReportDialog({ eventId: '{{ request.sentry_last_event_id() }}' })
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
@ -24,8 +24,14 @@
|
||||
|
||||
import types
|
||||
|
||||
from sentry_sdk import last_event_id
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponseForbidden, HttpResponseNotFound
|
||||
from django.http import (
|
||||
HttpResponseForbidden,
|
||||
HttpResponseNotFound,
|
||||
HttpResponseServerError,
|
||||
)
|
||||
from django.template import RequestContext
|
||||
from django.core.exceptions import (
|
||||
PermissionDenied,
|
||||
ObjectDoesNotExist,
|
||||
@ -65,6 +71,11 @@ def not_found(request):
|
||||
return HttpResponseNotFound(render(request, "core/404.jinja"))
|
||||
|
||||
|
||||
def internal_servor_error(request):
|
||||
request.sentry_last_event_id = last_event_id
|
||||
return HttpResponseServerError(render(request, "core/500.jinja"))
|
||||
|
||||
|
||||
def can_edit_prop(obj, user):
|
||||
if obj is None or user.is_owner(obj):
|
||||
return True
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -48,6 +48,7 @@ js_info_dict = {"packages": ("sith",)}
|
||||
|
||||
handler403 = "core.views.forbidden"
|
||||
handler404 = "core.views.not_found"
|
||||
handler500 = "core.views.internal_servor_error"
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^", include("core.urls", namespace="core", app_name="core")),
|
||||
|
Loading…
Reference in New Issue
Block a user