aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/controller.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/web/controller.py b/web/controller.py
index 2275733..b4f5189 100644
--- a/web/controller.py
+++ b/web/controller.py
@@ -517,12 +517,21 @@ def database_connect():
sys.exit(1)
return database
+def handle_error():
+ """Handle any unhandled exceptions.
+ It turns out a lot of our code raises exceptions that cause 500's for users
+ Instead of raising a 500 (for say, an invalid atom) simply return a 404
+ instead. The exception should still get logged.
+ """
+ cherrypy.response.status = 404
+
def main():
"""Use this when we run standalone"""
# site-wide config
cherrypy.config.update({
#'environment': 'production',
+ 'response.error_response' = handle_error,
'log.screen': True,
'log.error_file': '/tmp/cherrypy_packages2.gentoo.log',
@@ -575,7 +584,7 @@ def setup_server():
# if something goes wrong, we get a log.
cherrypy.config.update({
#'environment': 'production',
-
+ 'response.error_response' = handle_error,
'log.screen': False,
'log.error_file': '/tmp/cherrypy_packages2.gentoo.log',