Skip to content
Snippets Groups Projects
Commit 5cb103a2 authored by vlorentz's avatar vlorentz
Browse files

raise TransientRemoteException for 502 errors

parent d9c17435
No related branches found
No related tags found
1 merge request!344raise TransientRemoteException for 502 errors
Pipeline #1343 passed
......@@ -343,7 +343,7 @@ class RPCClient(metaclass=MetaRPCClient):
elif status_class == 5:
cls: Type[RemoteException]
if status_code == 503:
if status_code in (502, 503):
# This isn't a generic HTTP client and we know the server does
# not support the Retry-After header, so we do not implement
# it here either.
......
......@@ -149,7 +149,7 @@ def test_client_reraise_exception(rpc_client, requests_mock):
assert str(exc_info.value) == error_message
@pytest.mark.parametrize("status_code", [400, 500, 503])
@pytest.mark.parametrize("status_code", [400, 500, 502, 503])
def test_client_raise_remote_exception(rpc_client, requests_mock, status_code):
"""
Exception caught server-side and not whitelisted will be wrapped and raised
......@@ -171,7 +171,7 @@ def test_client_raise_remote_exception(rpc_client, requests_mock, status_code):
assert str(exc_info.value.args[0]["type"]) == "Exception"
assert str(exc_info.value.args[0]["message"]) == error_message
if status_code == 503:
if status_code in (502, 503):
assert isinstance(exc_info.value, TransientRemoteException)
else:
assert not isinstance(exc_info.value, TransientRemoteException)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment