Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
42
Issues
42
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
bdd84277
Verified
Commit
bdd84277
authored
Oct 10, 2018
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sentry: integration with error 500 page
parent
f7be284b
Pipeline
#1555
passed with stage
in 7 minutes and 51 seconds
Changes
4
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
654 additions
and
621 deletions
+654
-621
core/templates/core/500.jinja
core/templates/core/500.jinja
+15
-0
core/views/__init__.py
core/views/__init__.py
+13
-1
locale/fr/LC_MESSAGES/django.po
locale/fr/LC_MESSAGES/django.po
+625
-620
sith/urls.py
sith/urls.py
+1
-0
No files found.
core/templates/core/500.jinja
0 → 100644
View file @
bdd84277
{%
extends
"core/base.jinja"
%}
{%
block
head
%}
{{
super
()
}}
<script
src=
"https://browser.sentry-cdn.com/4.0.6/bundle.min.js"
crossorigin=
"anonymous"
></script>
{%
endblock
head
%}
{%
block
content
%}
<h3>
{%
trans
%}
500, Server Error
{%
endtrans
%}
</h3>
{%
if
request.sentry_dsn
%}
<script>
Sentry
.
init
({
dsn
:
'
{{
request.sentry_dsn
}}
'
});
Sentry
.
showReportDialog
({
eventId
:
'
{{
request.sentry_last_event_id
()
}}
'
})
</script>
{%
endif
%}
{%
endblock
content
%}
core/views/__init__.py
View file @
bdd84277
...
...
@@ -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,12 @@ def not_found(request):
return
HttpResponseNotFound
(
render
(
request
,
"core/404.jinja"
))
def
internal_servor_error
(
request
):
request
.
sentry_dsn
=
settings
.
SENTRY_DSN
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
...
...
locale/fr/LC_MESSAGES/django.po
View file @
bdd84277
This diff is collapsed.
Click to expand it.
sith/urls.py
View file @
bdd84277
...
...
@@ -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"
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment