github_webhook: Return 200 OK if event is not supported.

Change raising exception when event is not supported to just logging it.
This commit is contained in:
Tomasz Kolek
2017-03-21 21:56:13 +01:00
committed by Tim Abbott
parent fcd091132d
commit 09f5180da9

View File

@@ -409,10 +409,8 @@ def get_event(request, payload):
return 'assigned_or_unassigned_pull_request'
if action == 'closed':
return 'closed_pull_request'
if action in ('labeled', 'unlabeled', 'review_requested', 'review_request_removed'):
logging.warn('Event pull_request with {} action is unsupported'.format(action))
return None
raise UnknownEventType(u'Event pull_request with {} action is unsupported'.format(action))
logging.warn(u'Event pull_request with {} action is unsupported'.format(action))
return None
if event == 'push':
if is_commit_push_event(payload):
return "push_commits"
@@ -420,7 +418,8 @@ def get_event(request, payload):
return "push_tags"
elif event in list(EVENT_FUNCTION_MAPPER.keys()) or event == 'ping':
return event
raise UnknownEventType(u'Event {} is unknown and cannot be handled'.format(event))
logging.warn(u'Event {} is unknown and cannot be handled'.format(event))
return None
def get_body_function_based_on_type(type):
# type: (str) -> Any