Skip to content

Commit

Permalink
Merge pull request #3 from sprockets/ignore-web-finish
Browse files Browse the repository at this point in the history
Ignore web finish
  • Loading branch information
dave-shawley committed Dec 18, 2015
2 parents 0df6fd2 + a117bb5 commit e90aad6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ python:
- 3.2
- 3.3
- 3.4
- 3.5
install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi
- pip install -r test-requirements.txt
Expand Down
5 changes: 5 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ http://localhost:8000/whatever provided that *whatever* is not an integer.

Version History
---------------
* `0.4.0`_ (16-Dec-2015)

- Ignore web.Finish exceptions

* `0.3.0`_ (13-Jul-2015)

- Add ``sprockets.mixins.sentry.SentryMixin.sentry_extra``
Expand Down Expand Up @@ -67,6 +71,7 @@ License
.. _0.1.0: https://github.com/sprockets/sprockets.mixins.sentry/compare/e01c264...0.1.0
.. _0.2.0: https://github.com/sprockets/sprockets.mixins.sentry/compare/0.1.0...0.2.0
.. _0.3.0: https://github.com/sprockets/sprockets.mixins.sentry/compare/0.2.0...0.3.0
.. _0.4.0: https://github.com/sprockets/sprockets.mixins.sentry/compare/0.3.0...0.4.0

.. |Version| image:: https://badge.fury.io/py/sprockets.mixins.sentry.svg?
:target: http://badge.fury.io/py/sprockets.mixins.sentry
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def read_requirements_file(req_name):

setuptools.setup(
name='sprockets.mixins.sentry',
version='0.3.0',
version='0.4.0',
description='A RequestHandler mixin for sending exceptions to Sentry',
long_description=codecs.open('README.rst', encoding='utf-8').read(),
url='https://github.com/sprockets/sprockets.mixins.sentry.git',
Expand All @@ -51,6 +51,7 @@ def read_requirements_file(req_name):
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries',
Expand Down
6 changes: 4 additions & 2 deletions sprockets/mixins/sentry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
A RequestHandler mixin for sending exceptions to Sentry
"""
version_info = (0, 3, 0)
version_info = (0, 4, 0)
__version__ = '.'.join(str(v) for v in version_info)


Expand Down Expand Up @@ -79,7 +79,9 @@ def _strip_uri_passwords(self, values):
return values

def _handle_request_exception(self, e):
if isinstance(e, web.HTTPError) or self.sentry_client is None:
if (isinstance(e, web.HTTPError)
or isinstance(e, web.Finish)
or self.sentry_client is None):
return super(SentryMixin, self)._handle_request_exception(e)

duration = math.ceil((time.time() - self.request._start_time) * 1000)
Expand Down
6 changes: 6 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def get(self, action):
raise RuntimeError('something unexpected')
if action == 'http-error':
raise web.HTTPError(500)
if action == 'web-finish':
raise web.Finish()
if action == 'add-tags':
self.sentry_tags['some_tag'] = 'some_value'
raise RuntimeError
Expand Down Expand Up @@ -115,3 +117,7 @@ def test_that_status_codes_are_not_reported(self):
def test_that_http_errors_are_not_reported(self):
self.fetch('/http-error')
self.assertIsNone(self.get_sentry_message())

def test_that_web_finish_is_not_reported(self):
self.fetch('/web-finish')
self.assertIsNone(self.get_sentry_message())

0 comments on commit e90aad6

Please sign in to comment.