mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-28 06:23:07 +00:00
test(proxy): pin a 500 for exceptions whose status is None
This commit is contained in:
parent
53a27fee6c
commit
07df4ff09c
1 changed files with 10 additions and 1 deletions
|
|
@ -202,7 +202,7 @@ def test_handle_exception_on_proxy_labels_an_http_exception_by_the_status_it_ans
|
|||
assert (result.code, result.type) == (str(status_code), expected_type)
|
||||
|
||||
|
||||
def _exception_carrying_status(carried: int) -> Exception:
|
||||
def _exception_carrying_status(carried: int | None) -> Exception:
|
||||
class _CarriedStatus(Exception):
|
||||
status_code = carried
|
||||
|
||||
|
|
@ -236,6 +236,15 @@ def test_handle_exception_on_proxy_keeps_the_type_the_exception_already_names():
|
|||
assert (result.code, result.type) == ("429", "throttling_error")
|
||||
|
||||
|
||||
def test_handle_exception_on_proxy_answers_500_for_an_exception_whose_status_is_none():
|
||||
"""A guardrail whose upstream refuses the connection raises with status_code=None, and
|
||||
passing that through as the code crashed the proxy's error handler, which then blamed the
|
||||
auth database with a 503 instead of naming the unreachable guardrail."""
|
||||
result = handle_exception_on_proxy(_exception_carrying_status(None))
|
||||
|
||||
assert (result.code, result.type, result.message) == ("500", ProxyErrorTypes.internal_server_error.value, "boom")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exc",
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue