Jeremiah Lowin commited on
Commit
faf4760
·
1 Parent(s): 445f86a

Pass httpxerrors through

Browse files
Files changed (1) hide show
  1. src/fastmcp/client/client.py +3 -1
src/fastmcp/client/client.py CHANGED
@@ -294,7 +294,9 @@ class Client(Generic[ClientTransportT]):
294
  and not self._session_task.cancelled()
295
  ):
296
  exception = self._session_task.exception()
297
- if exception is not None:
 
 
298
  raise RuntimeError(
299
  f"Client failed to connect: {exception}"
300
  ) from exception
 
294
  and not self._session_task.cancelled()
295
  ):
296
  exception = self._session_task.exception()
297
+ if isinstance(exception, httpx.HTTPStatusError):
298
+ raise exception
299
+ elif exception is not None:
300
  raise RuntimeError(
301
  f"Client failed to connect: {exception}"
302
  ) from exception