Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

fix: resolve ty unresolved-attribute on RuntimeError.status_code

Cursor Agent6b9bc617cb39
diff --git a/tests/test_api.py b/tests/test_api.py
index 905c7643..52c5f214 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -135,10 +135,13 @@ def test_generic_exception_returns_500():
def test_generic_exception_with_status_code():
"""Generic exception with status_code attribute uses that status (getattr fallback)."""
+ class ExceptionWithStatus(RuntimeError):
+ def __init__(self, msg: str, status_code: int = 500):
+ super().__init__(msg)
+ self.status_code = status_code
+
def _raise_with_status(*args, **kwargs):
- e = RuntimeError("bad gateway")
- e.status_code = 502
- raise e
+ raise ExceptionWithStatus("bad gateway", 502)
mock_provider.stream_response = _raise_with_status
response = client.post(