Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(extension): chain original exception in APIBasedExtensionRequestor per PEP 3134 (#40810)
Harsh Kashyapd43685bc79db
diff --git a/api/core/extension/api_based_extension_requestor.py b/api/core/extension/api_based_extension_requestor.pyindex 01139d07e27..7e3720943e0 100644--- a/api/core/extension/api_based_extension_requestor.py+++ b/api/core/extension/api_based_extension_requestor.py@@ -41,10 +41,10 @@ class APIBasedExtensionRequestor:json={"point": point.value, "params": params},headers=headers,)- except httpx.TimeoutException:- raise ValueError("request timeout")- except httpx.RequestError:- raise ValueError("request connection error")+ except httpx.TimeoutException as e:+ raise ValueError("request timeout") from e+ except httpx.RequestError as e:+ raise ValueError("request connection error") from eif response.status_code != 200:raise ValueError(f"request error, status_code: {response.status_code}, content: {response.text[:100]}")diff --git a/api/tests/unit_tests/core/extension/test_api_based_extension_requestor.py b/api/tests/unit_tests/core/extension/test_api_based_extension_requestor.pyindex 9c1cbe82a0c..5ecc9fc5967 100644--- a/api/tests/unit_tests/core/extension/test_api_based_extension_requestor.py+++ b/api/tests/unit_tests/core/extension/test_api_based_extension_requestor.py@@ -89,23 +89,29 @@ def test_request_timeout(mocker: MockerFixture):mock_client = mocker.MagicMock()mock_client_instance = mock_client.__enter__.return_valuemocker.patch("httpx.Client", return_value=mock_client)- mock_client_instance.request.side_effect = httpx.TimeoutException("timeout")+ original = httpx.TimeoutException("timeout")+ mock_client_instance.request.side_effect = originalrequestor = APIBasedExtensionRequestor(api_endpoint="http://example.com", api_key="test_key")- with pytest.raises(ValueError, match="request timeout"):+ with pytest.raises(ValueError, match="request timeout") as exc_info:requestor.request(APIBasedExtensionPoint.PING, {})+ assert exc_info.value.__cause__ is original+def test_request_connection_error(mocker: MockerFixture):mock_client = mocker.MagicMock()mock_client_instance = mock_client.__enter__.return_valuemocker.patch("httpx.Client", return_value=mock_client)- mock_client_instance.request.side_effect = httpx.RequestError("error")+ original = httpx.RequestError("error")+ mock_client_instance.request.side_effect = originalrequestor = APIBasedExtensionRequestor(api_endpoint="http://example.com", api_key="test_key")- with pytest.raises(ValueError, match="request connection error"):+ with pytest.raises(ValueError, match="request connection error") as exc_info:requestor.request(APIBasedExtensionPoint.PING, {})+ assert exc_info.value.__cause__ is original+def test_request_error_status_code(mocker: MockerFixture):mock_client = mocker.MagicMock()