MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _transport_error_response

Function _transport_error_response

uncommon_route/proxy.py:4972–4987  ·  view source on GitHub ↗
(exc: httpx.TransportError)

Source from the content-addressed store, hash-verified

4970 return status_code in (400, 404, 422) and _is_model_error(content)
4971
4972 def _transport_error_response(exc: httpx.TransportError) -> httpx.Response:
4973 status_code = 504 if isinstance(exc, httpx.TimeoutException) else 502
4974 error_type = "timeout" if status_code == 504 else "proxy_error"
4975 if status_code == 504:
4976 message = "Upstream request timed out"
4977 elif isinstance(exc, httpx.ConnectError):
4978 message = f"Upstream unreachable: {upstream_chat}"
4979 else:
4980 message = "Upstream disconnected before sending a response"
4981 detail = str(exc).strip()
4982 if detail:
4983 message = f"{message}: {detail}"
4984 return httpx.Response(
4985 status_code,
4986 json={"error": {"message": message, "type": error_type}},
4987 )
4988
4989 async def _post_non_stream_attempt(attempt_payload: dict[str, Any]) -> httpx.Response:
4990 try:

Callers 1

_post_non_stream_attemptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected