-
-
Notifications
You must be signed in to change notification settings - Fork 653
web.py and wsgi problem #351
Description
Hey,
So we are trying to wrap raven.middleware around our WSGI application. The problem is that when we do - raven still does not send exceptions to Sentry. raven test worked fine, so we are sure there is a connection to Sentry server.I did some debugging in raven.middleware and found out that our web.py WSGI application does not trigger any of the cases that call self.handle_exception(environ). I did slight modification on the call method:
def __call__(self, environ, start_response):
try:
iterable = self.application(environ, start_response)
except Exception:
self.handle_exception(environ)
raise
try:
for event in iterable:
yield event
except Exception:
self.handle_exception(environ)
raise
finally:
# wsgi spec requires iterable to call close if it exists
# see http://blog.dscpl.com.au/2012/10/obligations-for-calling-close-on.html
if iterable and hasattr(iterable, 'close') and callable(iterable.close):
try:
iterable.close()
except Exception:
self.handle_exception(environ)
else:
print "Force handle exception"
self.handle_exception(environ)
The last else did work. And the Exception did get to the Sentry. The exception was empty. Just the name.
So the question here: is this a web.py issue ? or Raven. I am aware that raven is working according all WSGI specifications, but we did try using NewRelic before, and their wrapper worked just fine.
I will post similar issue on web.py repo as well. Hopefully we will figure something out.