stripe: Fix exception handler for suppressed events.

Apparently, we incorrectly placed the try/except block around the
common code, not the code that can actually raise these exceptions.
This commit is contained in:
Tim Abbott
2018-12-13 10:22:19 -08:00
parent 76c6cf8c3a
commit e7746809d2

View File

@@ -25,13 +25,13 @@ class SuppressedEvent(Exception):
def api_stripe_webhook(request: HttpRequest, user_profile: UserProfile,
payload: Dict[str, Any]=REQ(argument_type='body'),
stream: str=REQ(default='test')) -> HttpResponse:
topic, body = topic_and_body(payload)
try:
check_send_webhook_message(request, user_profile, topic, body)
topic, body = topic_and_body(payload)
except NotImplementedEventType: # nocoverage
pass
except SuppressedEvent: # nocoverage
pass
check_send_webhook_message(request, user_profile, topic, body)
return json_success()
def topic_and_body(payload: Dict[str, Any]) -> Tuple[str, str]: