Skip to content

Commit

Permalink
Merge pull request #5 from gadventures/exceptions
Browse files Browse the repository at this point in the history
Raise Exceptions instead of returning them
  • Loading branch information
bartek authored Sep 15, 2016
2 parents 5ec11a4 + 82989c6 commit 630c70e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions hooked/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ def clean_events(self, request):
events = json.loads(request.body)
except ValueError:
self.log_failure('Invalid webhook POST', exc_info=True)
return HttpResponseBadRequest('Cannot parse JSON')
raise HttpResponseBadRequest('Cannot parse JSON')

if not isinstance(events, list):
self.log_failure('Webhook events is not a list')
return HttpResponseBadRequest(INVALID_EVENT_MESSAGE)
raise HttpResponseBadRequest(INVALID_EVENT_MESSAGE)

if not self.validate_events(events):
self.log_failure('Webhook events do not validate')
return HttpResponseBadRequest(INVALID_EVENT_MESSAGE)
raise HttpResponseBadRequest(INVALID_EVENT_MESSAGE)
return events

def post(self, request, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='django-hooked',
version='0.2.0',
version='0.3.0',
author='G Adventures',
author_email='[email protected]',
url='https://github.com/gadventures/django-gapi-hooked',
Expand Down

0 comments on commit 630c70e

Please sign in to comment.