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

Commit

Permalink
Bug/1388 (#1389)
Browse files Browse the repository at this point in the history
* bug: only use `failure()` on exceptions in write_error

Closes #1388
  • Loading branch information
jrconlin authored May 7, 2020
1 parent 2a2649f commit d11f5ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions autopush/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ 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,
client_info=self._client_info)
self.log.error("Error in handler: %s" % code,
client_info=self._client_info)
self.finish()
except Exception as ex:
self.log.failure(
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 d11f5ac

Please sign in to comment.