diff --git a/opbeat/contrib/django/client.py b/opbeat/contrib/django/client.py index ac921b2d..53bbcc5f 100644 --- a/opbeat/contrib/django/client.py +++ b/opbeat/contrib/django/client.py @@ -164,8 +164,9 @@ def capture(self, event_type, request=None, **kwargs): if is_http_request: data.update(self.get_data_from_request(request)) - if kwargs.get('exc_info'): - exc_value = kwargs['exc_info'][1] + exc_info = kwargs.get('exc_info') + if exc_info: + exc_value = exc_info[1] # As of r16833 (Django) all exceptions may contain a ``django_template_source`` attribute (rather than the # legacy ``TemplateSyntaxError.source`` check) which describes template information. if hasattr(exc_value, 'django_template_source') or ((isinstance(exc_value, TemplateSyntaxError) and