Skip to content

Instantly share code, notes, and snippets.

@chmouel
Created February 17, 2013 11:19
Show Gist options
  • Save chmouel/4971044 to your computer and use it in GitHub Desktop.
Save chmouel/4971044 to your computer and use it in GitHub Desktop.
diff --git i/keystone/common/wsgi.py w/keystone/common/wsgi.py
index 5abbc46..816f062 100644
--- i/keystone/common/wsgi.py
+++ w/keystone/common/wsgi.py
@@ -345,11 +345,21 @@ class Middleware(Application):
@webob.dec.wsgify(RequestClass=Request)
def __call__(self, request):
- response = self.process_request(request)
- if response:
- return response
- response = request.get_response(self.application)
- return self.process_response(request, response)
+ try:
+ response = self.process_request(request)
+ if response:
+ return response
+ response = request.get_response(self.application)
+ return self.process_response(request, response)
+ except exception.Error as e:
+ LOG.warning(e)
+ return render_exception(e)
+ except TypeError as e:
+ logging.exception(e)
+ return render_exception(exception.ValidationError(e))
+ except Exception as e:
+ logging.exception(e)
+ return render_exception(exception.UnexpectedError(exception=e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment