Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
2cd17f64
Commit
2cd17f64
authored
Jul 22, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend HTTPExceptionHandler to deal with any exception.
parent
d69a8576
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
src/Zope2/Startup/httpexceptions.py
src/Zope2/Startup/httpexceptions.py
+33
-1
No files found.
src/Zope2/Startup/httpexceptions.py
View file @
2cd17f64
from
zExceptions
import
HTTPException
from
zExceptions
import
(
HTTPException
,
InternalError
,
)
ERROR_HTML
=
"""
\
<html>
<head><title>Site Error</title></head>
<body bgcolor="#FFFFFF">
<h2>Site Error</h2>
<p>An error was encountered while publishing this resource.
</p>
<p><strong>Sorry, a site error occurred.</strong></p>
%s
<hr noshade="noshade"/>
<p>Troubleshooting Suggestions</p>
<ul>
<li>The URL may be incorrect.</li>
<li>The parameters passed to this resource may be incorrect.</li>
<li>A resource that this resource relies on may be
encountering an error.</li>
</ul>
<p>If the error persists please contact the site maintainer.
Thank you for your patience.
</p></body></html>"""
class
HTTPExceptionHandler
(
object
):
class
HTTPExceptionHandler
(
object
):
...
@@ -12,6 +40,10 @@ class HTTPExceptionHandler(object):
...
@@ -12,6 +40,10 @@ class HTTPExceptionHandler(object):
return
self
.
application
(
environ
,
start_response
)
return
self
.
application
(
environ
,
start_response
)
except
HTTPException
as
exc
:
except
HTTPException
as
exc
:
return
exc
(
environ
,
start_response
)
return
exc
(
environ
,
start_response
)
except
Exception
as
exc
:
wrapper
=
InternalError
()
wrapper
.
setBody
(
ERROR_HTML
%
repr
(
exc
))
return
wrapper
(
environ
,
start_response
)
def
main
(
app
,
global_conf
=
None
):
def
main
(
app
,
global_conf
=
None
):
...
...
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