Skip to content

Commit

Permalink
Merge pull request #520 from beer-garden/wait_timeout_exception
Browse files Browse the repository at this point in the history
408 to 504 mapping
  • Loading branch information
TheBurchLog authored Dec 2, 2024
2 parents a59e2f9 + 5cbe005 commit 63bfd72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Brewtils Changelog
==================

3.29.1
------
TBD

- Updated Wait Timeout Exception expected HTTP code from 408 to 504

3.29.0
------
11/25/24
Expand Down
6 changes: 3 additions & 3 deletions brewtils/rest/easy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def handle_response_failure(response, default_exc=RestError, raise_404=True):
Raises:
NotFoundError: Status code 404 and raise_404 is True
WaitExceededError: Status code 408
ConflictError: Status code 409
TooLargeError: Status code 413
ValidationError: Any other 4xx status codes
RestConnectionError: Status code 503
WaitExceededError: Status code 504
default_exc: Any other status code
"""
try:
Expand All @@ -79,8 +79,6 @@ def handle_response_failure(response, default_exc=RestError, raise_404=True):
raise NotFoundError(message)
else:
return None
elif response.status_code == 408:
raise WaitExceededError(message)
elif response.status_code == 409:
raise ConflictError(message)
elif response.status_code == 413:
Expand All @@ -89,6 +87,8 @@ def handle_response_failure(response, default_exc=RestError, raise_404=True):
raise ValidationError(message)
elif response.status_code == 503:
raise RestConnectionError(message)
elif response.status_code == 504:
raise WaitExceededError(message)
else:
raise default_exc(message)

Expand Down
2 changes: 1 addition & 1 deletion test/rest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def not_found():

@pytest.fixture
def wait_exceeded():
return Mock(ok=False, status_code=408, json=Mock(return_value="payload"))
return Mock(ok=False, status_code=504, json=Mock(return_value="payload"))


@pytest.fixture
Expand Down

0 comments on commit 63bfd72

Please sign in to comment.