mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-15 05:54:11 +02:00
split message and apply to more scenarios
This commit is contained in:
parent
7a935d11fc
commit
72f256e0b8
2 changed files with 6 additions and 8 deletions
|
@ -174,6 +174,8 @@ class EPPLibWrapper:
|
||||||
try:
|
try:
|
||||||
return self._send(command)
|
return self._send(command)
|
||||||
except RegistryError as err:
|
except RegistryError as err:
|
||||||
|
if err.response:
|
||||||
|
logger.info(f"cltrid is {err.response.cl_tr_id} svtrid is {err.response.sv_tr_id}")
|
||||||
if (
|
if (
|
||||||
err.is_transport_error()
|
err.is_transport_error()
|
||||||
or err.is_connection_error()
|
or err.is_connection_error()
|
||||||
|
@ -182,12 +184,7 @@ class EPPLibWrapper:
|
||||||
or err.should_retry()
|
or err.should_retry()
|
||||||
):
|
):
|
||||||
message = f"{cmd_type} failed and will be retried"
|
message = f"{cmd_type} failed and will be retried"
|
||||||
info_message = f"{message} Error: {err}"
|
logger.info(f"{message} Error: {err}")
|
||||||
if err.response:
|
|
||||||
info_message = (
|
|
||||||
f"{info_message}| cltrid is {err.response.cl_tr_id} svtrid is {err.response.sv_tr_id}"
|
|
||||||
)
|
|
||||||
logger.info(f"{info_message}")
|
|
||||||
return self._retry(command)
|
return self._retry(command)
|
||||||
else:
|
else:
|
||||||
raise err
|
raise err
|
||||||
|
|
|
@ -311,9 +311,10 @@ class TestClient(TestCase):
|
||||||
# send() is called 5 times: send(login), send(command) fail, send(logout), send(login), send(command)
|
# send() is called 5 times: send(login), send(command) fail, send(logout), send(login), send(command)
|
||||||
self.assertEquals(mock_send.call_count, 5)
|
self.assertEquals(mock_send.call_count, 5)
|
||||||
# Assertion proper logging; note that the
|
# Assertion proper logging; note that the
|
||||||
mock_logger.info.assert_called_once_with(
|
mock_logger.info.assert_any_call(
|
||||||
"InfoDomainCommand failed and will be retried Error: Registrar is not logged in.| cltrid is cl_tr_id svtrid is sv_tr_id"
|
"InfoDomainCommand failed and will be retried Error: Registrar is not logged in."
|
||||||
)
|
)
|
||||||
|
mock_logger.info.assert_any_call("cltrid is cl_tr_id svtrid is sv_tr_id")
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def fake_failure_send_concurrent_threads(self, command=None, cleaned=None):
|
def fake_failure_send_concurrent_threads(self, command=None, cleaned=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue