Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4c85c0e6
authored
Jul 18, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: show unhandled HumanReadableExceptions on http500 page
parent
79712693
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletions
+42
-1
circle/circle/urls.py
+2
-0
circle/common/views.py
+33
-0
circle/templates/500.html
+7
-1
No files found.
circle/circle/urls.py
View file @
4c85c0e6
...
...
@@ -64,3 +64,5 @@ if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
''
,
(
r'^saml2/'
,
include
(
'djangosaml2.urls'
)),
)
handler500
=
'common.views.handler500'
circle/common/views.py
0 → 100644
View file @
4c85c0e6
from
sys
import
exc_info
import
logging
from
django.template
import
RequestContext
from
django.shortcuts
import
render_to_response
from
.models
import
HumanReadableException
logger
=
logging
.
getLogger
(
__name__
)
def
handler500
(
request
):
cls
,
exception
,
traceback
=
exc_info
()
logger
.
exception
(
"unhandled exception"
)
ctx
=
{}
if
isinstance
(
exception
,
HumanReadableException
):
try
:
ctx
[
'error'
]
=
exception
.
get_user_text
()
except
:
pass
else
:
try
:
if
request
.
user
.
is_superuser
():
ctx
[
'error'
]
=
exception
.
get_admin_text
()
except
:
pass
try
:
resp
=
render_to_response
(
"500.html"
,
ctx
,
RequestContext
(
request
))
except
:
resp
=
render_to_response
(
"500.html"
,
ctx
)
resp
.
status_code
=
500
return
resp
circle/templates/500.html
View file @
4c85c0e6
{% extends "base.html" %}
{% extends "
dashboard/
base.html" %}
{% load i18n %}
{% block title %}HTTP 500{% endblock %}
...
...
@@ -6,5 +6,11 @@
{% block page_title %}{% trans ":(" %}{% endblock page_title %}
{% block content %}
<div
style=
"margin-top: 4em;"
>
{% if error %}
<p>
{{ error }}
</p>
{% else %}
<p>
{% trans "Internal Server Error... Please leave the server alone..." %}
</p>
{% endif %}
</div>
{% endblock content %}
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