Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
bug: only use failure() on exceptions in write_error
Browse files Browse the repository at this point in the history
Closes #1388
  • Loading branch information
jrconlin committed May 7, 2020
1 parent 62c9ffd commit 3e7c2b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autopush/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def write_error(self, code, **kwargs):
failure=failure.Failure(*kwargs['exc_info']),
client_info=self._client_info)
else:
self.log.failure("Error in handler: %s" % code,
self.log.error("Error in handler: %s" % code,
client_info=self._client_info)
self.finish()
except Exception as ex:
Expand Down
5 changes: 4 additions & 1 deletion autopush/tests/test_web_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@ def test_write_error_no_exc(self):
with an invalid method (e.g. "put" instead of "PUT").
This is not code that is triggered within normal flow, but
by the cyclone wrapper.
NOTE: calling `failure` without an exception triggers an
exception. write_error should call `error`.
"""
self.base.write_error(999)
self.status_mock.assert_called_with(999)
assert self.base.log.failure.called is True
assert self.base.log.error.called is True

@patch('uuid.uuid4', return_value=uuid.UUID(dummy_request_id))
def test_init_info(self, t):
Expand Down

0 comments on commit 3e7c2b2

Please sign in to comment.