fix: use int() cast when comparing ProxyException.code (code is str not int)

This commit is contained in:
wangjifeng 2026-04-24 20:41:57 +08:00
parent 4bb6fc8f23
commit c7e3e50851

View file

@ -80,7 +80,7 @@ class UserAPIKeyAuthExceptionHandler:
# flooding error logs with routine access-control events.
# All other exceptions are unexpected and logged at ERROR with traceback.
_is_expected_auth_failure = (
isinstance(e, ProxyException) and e.code in (401, 403)
isinstance(e, ProxyException) and int(e.code) in (401, 403)
) or (
isinstance(e, HTTPException) and e.status_code in (401, 403)
)