diff --git a/chicago/feeds.py b/chicago/feeds.py index 7be6f94..f24b119 100644 --- a/chicago/feeds.py +++ b/chicago/feeds.py @@ -6,6 +6,7 @@ from django.utils.feedgenerator import Rss201rev2Feed from django.urls import reverse, reverse_lazy from django.conf import settings +from sentry_sdk import capture_exception from .models import ChicagoPerson, Bill, Organization, Event from .utils import to_datetime @@ -76,7 +77,8 @@ def item_link(self, bill): def item_pubdate(self, bill): try: return to_datetime(bill.last_action_date) - except AttributeError: + except AttributeError as e: + capture_exception(e) return None def description(self, obj): diff --git a/chicago/views.py b/chicago/views.py index 73cf4e2..2ea55e7 100644 --- a/chicago/views.py +++ b/chicago/views.py @@ -20,6 +20,8 @@ from django.views.generic import TemplateView, DetailView, ListView from haystack.generic_views import FacetedSearchView from haystack.forms import FacetedSearchForm +from sentry_sdk import capture_exception + from opencivicdata.core.models import Membership from opencivicdata.legislative.models import ( BillSponsorship, @@ -614,11 +616,14 @@ def get_context_data(self, **kwargs): event_orgs = event.participants.filter(entity_type="organization") context["event_orgs"] = event_orgs for event_org in event_orgs: - if event_org.organization: + try: org_members = event_org.organization.memberships.filter( start_date__lte=event.start_time, end_date__gte=event.start_time ).select_related("person__councilmatic_person") expected_attendees.update([m.person for m in org_members]) + except AttributeError as e: + # found an event without an organization + capture_exception(e) attendees = set() for event_person in event.attendance: