diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae489b7b0..d0f3b51cee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +## 0.14.4 (2024-12-03) + + +### Bug Fixes + +- Add try/except block on httpx transport of ocean client to log timeouts and other exceptions (Client timeouts not recorded) + + ## 0.14.3 (2024-11-25) diff --git a/port_ocean/helpers/retry.py b/port_ocean/helpers/retry.py index 9585c9439c..0893235c4a 100644 --- a/port_ocean/helpers/retry.py +++ b/port_ocean/helpers/retry.py @@ -132,13 +132,18 @@ def handle_request(self, request: httpx.Request) -> httpx.Response: httpx.Response: The response received. """ - transport: httpx.BaseTransport = self._wrapped_transport # type: ignore - if request.method in self._retryable_methods: - send_method = partial(transport.handle_request) - response = self._retry_operation(request, send_method) - else: - response = transport.handle_request(request) - return response + try: + transport: httpx.BaseTransport = self._wrapped_transport # type: ignore + if request.method in self._retryable_methods: + send_method = partial(transport.handle_request) + response = self._retry_operation(request, send_method) + else: + response = transport.handle_request(request) + return response + except Exception as e: + if not self._is_retryable_method(request) and self._logger is not None: + self._logger.exception(f"{repr(e)} - {request.url}", exc_info=e) + raise e async def handle_async_request(self, request: httpx.Request) -> httpx.Response: """Sends an HTTP request, possibly with retries. @@ -150,13 +155,19 @@ async def handle_async_request(self, request: httpx.Request) -> httpx.Response: The response. """ - transport: httpx.AsyncBaseTransport = self._wrapped_transport # type: ignore - if self._is_retryable_method(request): - send_method = partial(transport.handle_async_request) - response = await self._retry_operation_async(request, send_method) - else: - response = await transport.handle_async_request(request) - return response + try: + transport: httpx.AsyncBaseTransport = self._wrapped_transport # type: ignore + if self._is_retryable_method(request): + send_method = partial(transport.handle_async_request) + response = await self._retry_operation_async(request, send_method) + else: + response = await transport.handle_async_request(request) + return response + except Exception as e: + # Retyable methods are logged via _log_error + if not self._is_retryable_method(request) and self._logger is not None: + self._logger.exception(f"{repr(e)} - {request.url}", exc_info=e) + raise e async def aclose(self) -> None: """ diff --git a/pyproject.toml b/pyproject.toml index aecf1ec569..7f0d43c13d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.14.3" +version = "0.14.4" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"