From 8d6280b139dca2b232f1a716e3803e55ebc1ce05 Mon Sep 17 00:00:00 2001 From: SamRemis Date: Mon, 24 Nov 2025 18:31:37 -0500 Subject: [PATCH 1/6] Update error messages for timeout errors --- packages/smithy-core/src/smithy_core/aio/client.py | 3 ++- .../next-release/smithy-http-enhancement-20251122132342.json | 4 ++++ packages/smithy-http/src/smithy_http/aio/crt.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json diff --git a/packages/smithy-core/src/smithy_core/aio/client.py b/packages/smithy-core/src/smithy_core/aio/client.py index 01f18097b..a90a9b797 100644 --- a/packages/smithy-core/src/smithy_core/aio/client.py +++ b/packages/smithy-core/src/smithy_core/aio/client.py @@ -469,8 +469,9 @@ async def _handle_attempt[I: SerializeableShape, O: DeserializeableShape]( ) except Exception as e: if isinstance(e, self.transport.TIMEOUT_EXCEPTIONS): + error_msg = str(e) or type(e).__name__ raise ClientTimeoutError( - message=f"Client timeout occurred: {e}" + message=f"Client timeout occurred: {error_msg}" ) from e raise diff --git a/packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json b/packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json new file mode 100644 index 000000000..600353a5b --- /dev/null +++ b/packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json @@ -0,0 +1,4 @@ +{ + "type": "enhancement", + "description": "Improved error messaging for CRT-based timeout errors" +} \ No newline at end of file diff --git a/packages/smithy-http/src/smithy_http/aio/crt.py b/packages/smithy-http/src/smithy_http/aio/crt.py index db13162e1..d07065567 100644 --- a/packages/smithy-http/src/smithy_http/aio/crt.py +++ b/packages/smithy-http/src/smithy_http/aio/crt.py @@ -187,7 +187,7 @@ async def send( return await self._await_response(crt_stream) except AwsCrtError as e: if e.name in self._TIMEOUT_ERROR_NAMES: - raise _CRTTimeoutError() from e + raise _CRTTimeoutError(f"CRT {e.name}: {e.message}") raise async def _await_response( From 65e7de1c1fb456608d38435c424f3f66dd583e34 Mon Sep 17 00:00:00 2001 From: SamRemis Date: Mon, 24 Nov 2025 18:35:17 -0500 Subject: [PATCH 2/6] Create smithy-core-enhancement-20251124183509.json --- .../next-release/smithy-core-enhancement-20251124183509.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json diff --git a/packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json b/packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json new file mode 100644 index 000000000..b249f4755 --- /dev/null +++ b/packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json @@ -0,0 +1,4 @@ +{ + "type": "enhancement", + "description": "Improved default error message for instances of ClientTimeoutError cought in client.py" +} \ No newline at end of file From 72533a7f185b5e0899ec562c59db49fe1beb475b Mon Sep 17 00:00:00 2001 From: SamRemis Date: Wed, 3 Dec 2025 11:02:12 -0500 Subject: [PATCH 3/6] Apply suggestions from code review Co-authored-by: Nate Prewitt --- .../next-release/smithy-core-enhancement-20251124183509.json | 2 +- .../next-release/smithy-http-enhancement-20251122132342.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json b/packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json index b249f4755..56a70a6c1 100644 --- a/packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json +++ b/packages/smithy-core/.changes/next-release/smithy-core-enhancement-20251124183509.json @@ -1,4 +1,4 @@ { "type": "enhancement", - "description": "Improved default error message for instances of ClientTimeoutError cought in client.py" + "description": "Improved default error message for instances of ClientTimeoutError." } \ No newline at end of file diff --git a/packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json b/packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json index 600353a5b..d7b9f982e 100644 --- a/packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json +++ b/packages/smithy-http/.changes/next-release/smithy-http-enhancement-20251122132342.json @@ -1,4 +1,4 @@ { "type": "enhancement", - "description": "Improved error messaging for CRT-based timeout errors" + "description": "Improved error messaging for CRT-based timeout errors." } \ No newline at end of file From 1968b25b7453159c360aae4d860b1f8017286c3f Mon Sep 17 00:00:00 2001 From: SamRemis Date: Wed, 3 Dec 2025 17:04:41 -0500 Subject: [PATCH 4/6] Update crt.py --- packages/smithy-http/src/smithy_http/aio/crt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/smithy-http/src/smithy_http/aio/crt.py b/packages/smithy-http/src/smithy_http/aio/crt.py index d07065567..5e5cc861c 100644 --- a/packages/smithy-http/src/smithy_http/aio/crt.py +++ b/packages/smithy-http/src/smithy_http/aio/crt.py @@ -187,7 +187,7 @@ async def send( return await self._await_response(crt_stream) except AwsCrtError as e: if e.name in self._TIMEOUT_ERROR_NAMES: - raise _CRTTimeoutError(f"CRT {e.name}: {e.message}") + raise _CRTTimeoutError(f"CRT {e.name}: {e.message}") from e raise async def _await_response( From 6de75ed0c84c02e781d06fd526dd289fdec27308 Mon Sep 17 00:00:00 2001 From: SamRemis Date: Wed, 3 Dec 2025 18:35:10 -0500 Subject: [PATCH 5/6] Update client.py --- packages/smithy-core/src/smithy_core/aio/client.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/smithy-core/src/smithy_core/aio/client.py b/packages/smithy-core/src/smithy_core/aio/client.py index a90a9b797..6eaec4759 100644 --- a/packages/smithy-core/src/smithy_core/aio/client.py +++ b/packages/smithy-core/src/smithy_core/aio/client.py @@ -469,10 +469,8 @@ async def _handle_attempt[I: SerializeableShape, O: DeserializeableShape]( ) except Exception as e: if isinstance(e, self.transport.TIMEOUT_EXCEPTIONS): - error_msg = str(e) or type(e).__name__ - raise ClientTimeoutError( - message=f"Client timeout occurred: {error_msg}" - ) from e + error_msg = str(e) or "A timeout error occurred." + raise ClientTimeoutError(message=error_msg) from e raise _LOGGER.debug("Received response: %s", transport_response) From 49093efc89bfd36d411333900d819179d85a7e02 Mon Sep 17 00:00:00 2001 From: SamRemis Date: Thu, 4 Dec 2025 11:27:19 -0500 Subject: [PATCH 6/6] Update client.py --- packages/smithy-core/src/smithy_core/aio/client.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/smithy-core/src/smithy_core/aio/client.py b/packages/smithy-core/src/smithy_core/aio/client.py index 6eaec4759..6060727b4 100644 --- a/packages/smithy-core/src/smithy_core/aio/client.py +++ b/packages/smithy-core/src/smithy_core/aio/client.py @@ -469,8 +469,7 @@ async def _handle_attempt[I: SerializeableShape, O: DeserializeableShape]( ) except Exception as e: if isinstance(e, self.transport.TIMEOUT_EXCEPTIONS): - error_msg = str(e) or "A timeout error occurred." - raise ClientTimeoutError(message=error_msg) from e + raise ClientTimeoutError(message="A timeout error occurred.") from e raise _LOGGER.debug("Received response: %s", transport_response)