Files
Alberto Schiabel b2f5098b28 fix(py): make HTTP status errors catchable as ComposioError on client 2.0 (#4556)
This PR:

- relates to #4537 and ports
https://github.com/ComposioHQ/composio/pull/4543 (which targets `next`
on `composio-client==1.43.0`) to `main`, which pins
`composio-client==2.0.0rc7`
- the 2.0 client has no `_make_status_error` hook; it raises the
module-level `status_error()` from `_decode()` and
`_process_response()`, so `HttpClient` overrides those two instead
- raised errors subclass both the generated class and
`composio.exceptions.ComposioError` (one cached class per generated
class), so `except ComposioError` and `except
composio_client.AuthenticationError` both keep working, with
`status_code`, `response` and `body` unchanged
- the classes support `pickle`/`deepcopy` via `__reduce__`
- adds `python/tests/test_client_errors.py` (from #4543, minus the
`ToolNotFoundError` case, which only exists on `next`): 17 tests, 15 of
which fail without the override
- out of scope: `APIConnectionError`/`APITimeoutError` are still not
`ComposioError`
- when `next` and `main` reconcile, keep this version and drop the
`_make_status_error` override from #4543

Verified locally: full Python suite 1939 passed / 51 skipped (baseline
1922 / 51, no new failures); ruff clean; mypy shows only the 4 errors
already on `main` (`schema_converter.py`, `url_safety.py`).
2026-09-21 17:57:52 +04:00
..
2025-06-17 12:58:00 +05:30