Handle failures with context helpers

This commit is contained in:
David Cramer 2015-09-10 16:03:32 -05:00
parent e335057772
commit 24521704c6
1 changed files with 8 additions and 2 deletions

View File

@ -215,8 +215,14 @@ class Sentry(object):
def before_request(self, *args, **kwargs):
self.last_event_id = None
self.client.http_context(self.get_http_info(request))
self.client.user_context(self.get_user_info(request))
try:
self.client.http_context(self.get_http_info(request))
except Exception as e:
self.client.logger.exception(unicode(e))
try:
self.client.user_context(self.get_user_info(request))
except Exception as e:
self.client.logger.exception(unicode(e))
def after_request(self, sender, response, *args, **kwargs):
if self.last_event_id: